From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alef Farah Subject: How to pass an array of integers to a C code block with :var? Date: Tue, 9 Aug 2016 15:32:01 -0300 Message-ID: <20160809183201.GA1485@thinkpad> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXBp7-0005jj-GW for emacs-orgmode@gnu.org; Tue, 09 Aug 2016 14:32:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXBp2-0003T1-Gq for emacs-orgmode@gnu.org; Tue, 09 Aug 2016 14:32:21 -0400 Received: from smtp.inf.ufrgs.br ([143.54.11.23]:38747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXBp2-0003RT-7u for emacs-orgmode@gnu.org; Tue, 09 Aug 2016 14:32:16 -0400 Received: from thinkpad (unknown [143.54.10.102]) by smtp.inf.ufrgs.br (Postfix) with ESMTPSA id DF119120CF2 for ; Tue, 9 Aug 2016 15:32:05 -0300 (BRT) Content-Disposition: inline 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: emacs-orgmode@gnu.org Hi, I am trying to use babel's :var to pass an array of integers to a C code block. I can do it like this: #+begin_src C :var arr='(1 2) :includes printf("%d %d\n", arr[0], arr[1]); #+end_src However, I wish to assign the output of another code block to the variable, like this: #+name: input #+begin_src sh seq 2 #+end_src #+begin_src C :var arr=input :includes printf("%d %d\n", arr[0], arr[1]); #+end_src But this way, "arr" is evaluated as a string. I tried formatting the output of the input code block as '(1 2), but it is still evaluated as a string. Is there any way to do this without manually grabbing the list from the results of the input code block and pasting it in the C block?