emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] help with porting babel example on worg to latest version


From: Miguel Ruiz
Subject: Re: [O] help with porting babel example on worg to latest version
Date: Mon, 6 Jan 2014 10:28:43 +0000 (GMT)

What's the problem with:

#+name: fibonacci-inputs
| 1 | 2 | 3 | 4 |  5 |  6 |  7 |  8 |  9 | 10 |
| 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 |


#+name: fibonacci-seq
#+begin_src emacs-lisp :var fib-inputs=fibonacci-inputs
  (defun fibonacci (n)
    (if (or (= n 0) (= n 1))
        n
      (+ (fibonacci (- n 1)) (fibonacci (- n 2)))))

  (mapcar (lambda (row)
            (mapcar #'fibonacci row)) fib-inputs)
#+end_src

#+RESULTS: fibonacci-seq
| 1 | 1 | 2 |  3 |  5 |   8 |  13 |  21 |   34 |   55 |
| 1 | 3 | 8 | 21 | 55 | 144 | 377 | 987 | 2584 | 6765 |

?



El Lunes 6 de enero de 2014 8:03, Christian Wittern <address@hidden> escribió:
Hi there,

I am trying to understand how to use information from an org table as input
for a babel function.
For this purpose, I looked at the example at
http://orgmode.org/worg/org-contrib/babel/intro.html#arguments-to-source-code-blocks

It seems that this is using the old syntax, eg. #+tblname, which seems to be
just #+name now.  But even with this change I can not reproduce the result. 
With the following code, I get the message "Symbol's value as variable is
void: fib-inputs" when doing C-c on the src.  I am sure there are more
changes I need to make, but I can't figure it out.  Any help appreciated.
Here is the code so far:

#+name: fibonacci-inputs
| 1 | 2 | 3 | 4 |  5 |  6 |  7 |  8 |  9 | 10 |
| 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 |


#+name: fibonacci-seq(fib-inputs=fibonacci-inputs)
#+begin_src emacs-lisp
  (defun fibonacci (n)
    (if (or (= n 0) (= n 1))
        n
      (+ (fibonacci (- n 1)) (fibonacci (- n 2)))))

  (mapcar (lambda (row)
            (mapcar #'fibonacci row)) fib-inputs)
#+end_src


All the best,

Christian

--
Christian Wittern, Kyoto







reply via email to

[Prev in Thread] Current Thread [Next in Thread]