Hi Erik, dyb...@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 _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode