From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Serialise lisp objects for babel-supported langage Date: Tue, 16 Oct 2018 16:59:49 -0400 Message-ID: References: <87efcpr7ir.fsf@portable.galex-713.eu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000538b1c05785ed620" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCWRh-0000VH-OJ for emacs-orgmode@gnu.org; Tue, 16 Oct 2018 17:00:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCWRf-00049j-QU for emacs-orgmode@gnu.org; Tue, 16 Oct 2018 17:00:05 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:43310) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gCWRf-00046q-6J for emacs-orgmode@gnu.org; Tue, 16 Oct 2018 17:00:03 -0400 Received: by mail-wr1-x435.google.com with SMTP id n1-v6so27167250wrt.10 for ; Tue, 16 Oct 2018 14:00:02 -0700 (PDT) In-Reply-To: <87efcpr7ir.fsf@portable.galex-713.eu> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: galex-713@galex-713.eu Cc: org-mode-email --000000000000538b1c05785ed620 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This might be going the opposite direction, but I worked on a way to make it easier to digest the output of Python in elisp, in these two posts: http://kitchingroup.cheme.cmu.edu/blog/2015/05/16/Python-data-structures-to= -lisp/ http://kitchingroup.cheme.cmu.edu/blog/2016/05/30/Writing-lisp-code-from-Py= thon/ These days I would probably try serializing via json. it is easy to read and write in most languages. John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Tue, Oct 16, 2018 at 3:55 PM Garreau, Alexandre wrote: > Would it be useful to begin integrating into babel functions so to > serialize lisp objects (just as prin1-to-string) in other languages? > > I=E2=80=99ve read some babel files trying to do that, independently of ea= ch > others (that=E2=80=99s a lot of similar `typecase's (seeing it I=E2=80=99= m regretting > each type-spec in it can=E2=80=99t be a list of types) =E2=80=A6when auth= ors even think > about using typecase instead of just `cond' or `if's): for instance > Fortran, so that to declare variables given as arguments to its source > blocks. imho, that may be of some use for other languages. > > It may be useful as well for stuff outside of org-mode: e.g. iirc Pymacs > serialize/deserialize (read and print (and also eval, but not loop x))) > to allow the gateway between elisp and python and making each one > libraries available to the other. That must be (really partially) > redundant with python babel. And so on. > > I don=E2=80=99t know well-enough enough languages to begin doing it right= away, > and I might try to do only for scheme, ocaml and C then, so just > throwing the idea here. > > Moreafter: deserialization might come handy as well, as if trying to > factorize between serialization and deserialization, this might as well > some sort of lower grammar or anyway easier to read, extend and debug > form of specifying the translation. And then when a source block > outputs results, having a deserialization function might help to get > consistent output which then may be processed to make, for instance, > org-tables (though I know currently to do this it=E2=80=99s pretty impera= tive > and edition-oriented, rather than functional like this approach does > suggest). > > --000000000000538b1c05785ed620 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This might be going the = opposite direction, but I worked on a way to make it easier to digest the o= utput of Python in elisp, in these two posts:

These days I would probably try serializing via json. it is eas= y to read and write in most languages.

John

-----------------------------------
Professor John Kitch= in=C2=A0
Doherty Hall A207F
Department of Chemical Engineering
Car= negie Mellon University
Pittsburgh, PA 15213
412-268-7803


=
On Tue, Oct 16, 2018 at 3:55 PM Garreau, Alexandre <galex-713@galex-713.eu> wrote= :
Would it be useful to begin integ= rating into babel functions so to
serialize lisp objects (just as prin1-to-string) in other languages?

I=E2=80=99ve read some babel files trying to do that, independently of each=
others (that=E2=80=99s a lot of similar `typecase's (seeing it I=E2=80= =99m regretting
each type-spec in it can=E2=80=99t be a list of types) =E2=80=A6when author= s even think
about using typecase instead of just `cond' or `if's): for instance=
Fortran, so that to declare variables given as arguments to its source
blocks. imho, that may be of some use for other languages.

It may be useful as well for stuff outside of org-mode: e.g. iirc Pymacs serialize/deserialize (read and print (and also eval, but not loop x)))
to allow the gateway between elisp and python and making each one
libraries available to the other.=C2=A0 That must be (really partially)
redundant with python babel.=C2=A0 And so on.

I don=E2=80=99t know well-enough enough languages to begin doing it right a= way,
and I might try to do only for scheme, ocaml and C then, so just
throwing the idea here.

Moreafter: deserialization might come handy as well, as if trying to
factorize between serialization and deserialization, this might as well
some sort of lower grammar or anyway easier to read, extend and debug
form of specifying the translation.=C2=A0 And then when a source block
outputs results, having a deserialization function might help to get
consistent output which then may be processed to make, for instance,
org-tables (though I know currently to do this it=E2=80=99s pretty imperati= ve
and edition-oriented, rather than functional like this approach does
suggest).

--000000000000538b1c05785ed620--