From: "Eric Schulte" <schulte.eric@gmail.com>
To: "Erik L. Arneson" <dybbuk@LNouv.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-babel and OCaml - help?
Date: Fri, 16 Jul 2010 15:30:19 -0700 [thread overview]
Message-ID: <871vb383fu.fsf@gmail.com> (raw)
In-Reply-To: m2r5j38nqt.fsf@tyche.LNouv.com
Hi Erik,
dybbuk@LNouv.com (Erik L. Arneson) writes:
> Hi everybody,
>
> I have just started playing around with org-babel, and it's really
> awesome! I've had great luck with emacs-lisp source blocks, and when I
> saw that OCaml source blocks were also supported, I started testing
> those out. Right away I ran into trouble, though. Observe the example
> below:
>
> #+tblname: example-table
> | 1 | 2 |
> | 2 | 3 |
> | 3 | 5 |
> | 4 | 6 |
>
> #+source: ocaml-length
> #+begin_src ocaml :var table=example-table
> List.length table
> #+end_src
>
> #+results: ocaml-length
> : Characters 14-15:
> : let table = ((1 2) (2 3) (3 5) (4 6));
> : ^
> : Error: This expression is not a function; it cannot be applied
>
> #+results: ocaml-length
>
> It looks as though the 'table' variable is being passed as Lisp code
> instead of OCaml. Is there something that my setup is missing, or does
> the OCaml code perhaps need more help? Maybe I did something wrong?
>
Nope you diagnosed the problem exactly, this isn't an issue with your
setup, but rather with the current babel<->ocaml integration. The
language specific interaction functionality tends to evolve by need, and
I don't think many people have been banging on ocaml through Babel up to
this point.
I've just pushed up a commit with teaches Babel how to feed tables to
ocaml, so your example above re-written as below should now work.
--8<---------------cut here---------------start------------->8---
#+tblname: example-table
| 1 |
| 2 |
| 3 |
| 4 |
#+source: ocaml-length
#+begin_src ocaml :var table=example-table
Array.length table;;
#+end_src
#+results: ocaml-length
: 4
--8<---------------cut here---------------end--------------->8---
>
> (I'd love to work on fixing up the OCaml interface, if that's needed.)
I'd love to have your help! The relevant code is located in
org/lisp/ob-ocaml.el, you can see in the most recent commit the changes
that I've just made for integrating table handling into this file.
You'll notice by comparing ob-ocaml to some of the more mature code
files like ob-R, ob-python, ob-ruby that there are many areas in which
ob-ocaml could grow in functionality.
Cheers -- Eric
next prev parent reply other threads:[~2010-07-16 22:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-16 15:12 org-babel and OCaml - help? Erik L. Arneson
2010-07-16 19:59 ` [PATCH] Fix list assignments in ob-ocaml.el Erik L. Arneson
2010-07-16 20:59 ` Erik L. Arneson
2010-07-17 18:08 ` Eric Schulte
2010-07-17 0:41 ` Bernt Hansen
2010-07-16 22:30 ` Eric Schulte [this message]
2010-07-18 14:30 ` org-babel and OCaml - help? Erik L. Arneson
2010-07-18 17:07 ` Eric Schulte
2010-07-21 16:56 ` [babel] " Erik L. Arneson
2010-07-21 22:19 ` [babel] Re: org-babel and OCaml Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871vb383fu.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=dybbuk@LNouv.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).