diff --git a/org-babel-worg.org b/org-babel-worg.org index ef1a87269..a2a8e0ee4 100644 --- a/org-babel-worg.org +++ b/org-babel-worg.org @@ -52,17 +52,12 @@ git clone git://github.com/eschulte/org-babel.git results of excecution. E.g. place point anywhere in the following block and use C-c C-c to run the code: -#+begin_src python :results output -import time -x = 4 -print("hello\n") -#print time.ctime() -print [5, 10] +#+begin_src ruby +"This file was last evaluated on #{Date.today}" #+end_src #+resname: -: hello -: 510 +: This file was last evaluated on 2009-08-09 #+begin_src R :results value x = 4 @@ -95,11 +90,32 @@ c(5, 10) users). **** Additional :results settings -*** Arguments to source code blocks +*** QUOTE Arguments to source code blocks In addition to evaluation of code blocks, org-babel allows them to be parameterised (i.e. have arguments). Thus source code blocks now have the status of *functions*. +Inputs for fibonacci-seq + +#+tblname: fibonacci-inputs +| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | +| 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | + +#+srcname: 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 + +#+resname: +| 1 | 1 | 2 | 3 | 5 | 8 | 13 | 21 | 34 | 55 | +| 1 | 3 | 8 | 21 | 55 | 144 | 377 | 987 | 2584 | 6765 | + * A meta-programming language for org-mode * Spreadsheet plugins for org-mode in any language * Library of Babel