From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: input data for babel blocks Date: Tue, 01 Oct 2013 17:16:49 +0200 Message-ID: References: <87r4c5p456.fsf@gmail.com> <354a40d3e967378379adfecadf7d4af4@mail.rickster.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VR1h4-0006mz-84 for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 11:17:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VR1gx-0006uV-U4 for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 11:16:58 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:16060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VR1gx-0006uE-NS for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 11:16:51 -0400 In-reply-to: <354a40d3e967378379adfecadf7d4af4@mail.rickster.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rick Frankel Cc: emacs-orgmode@gnu.org, Charles Berry , Eric Schulte rick@rickster.com writes: > You're close. The noweb ref should be a named src block which is > executed, not expanded, so, (note the named shell source block and the > parens in the noweb reference): > > #+name: testing > #+BEGIN_SRC sh :results raw > echo "[" > ls *.org | sed 's/$/;/' > echo "]" > #+END_SRC > > #+BEGIN_SRC ocaml :noweb yes > let x = > <> > in x > #+END_SRC Thanks a lot, that was the missing piece! So, for the record, here is a way to convert a table as a list of tuples for use in ocaml. Thanks again to everyone for the help in getting there. --8<---------------cut here---------------start------------->8--- #+name: mydata | x | 1 | 1.4 | | y | 2 | 4.5 | | z | 3 | 7.0 | #+name: table_to_tuple #+BEGIN_SRC emacs-lisp :results raw :var v='() (message (concat "[" (mapconcat (lambda (vlist) (concat "(" (mapconcat (lambda (val) (format "%S" val)) vlist ", ") ")")) v "; ") "]")) #+END_SRC #+BEGIN_SRC ocaml :noweb yes let x = <> in x #+END_SRC #+RESULTS: : - : (string * int * float) list = : [("x", 1, 1.4); ("y", 2, 4.5); ("z", 3, 7.)] --8<---------------cut here---------------end--------------->8---