additions to org-babel-worg.org

This commit is contained in:
Eric Schulte 2009-08-09 12:36:10 -06:00
parent 2f50cb659f
commit 9f337b983c
1 changed files with 25 additions and 9 deletions

View File

@ -52,17 +52,12 @@ git clone git://github.com/eschulte/org-babel.git
results of excecution. E.g. place point anywhere in the following results of excecution. E.g. place point anywhere in the following
block and use C-c C-c to run the code: block and use C-c C-c to run the code:
#+begin_src python :results output #+begin_src ruby
import time "This file was last evaluated on #{Date.today}"
x = 4
print("hello\n")
#print time.ctime()
print [5, 10]
#+end_src #+end_src
#+resname: #+resname:
: hello : This file was last evaluated on 2009-08-09
: 510
#+begin_src R :results value #+begin_src R :results value
x = 4 x = 4
@ -95,11 +90,32 @@ c(5, 10)
users). users).
**** Additional :results settings **** 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 In addition to evaluation of code blocks, org-babel allows them to
be parameterised (i.e. have arguments). Thus source code blocks be parameterised (i.e. have arguments). Thus source code blocks
now have the status of *functions*. 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 * A meta-programming language for org-mode
* Spreadsheet plugins for org-mode in any language * Spreadsheet plugins for org-mode in any language
* Library of Babel * Library of Babel