I want to write a scheme program in an org file. I want to be able to execute the
#+SRC blcoks and see the result in
#+RESULT: block. However, when I execute the
#+SRC_BEGIN/END I get no output. Instead I get a guile REPL and that's it.
These are the config I have:
(setq geiser-default-implementation 'guile) (org-babel-do-load-languages 'org-babel-load-languages '((scheme . t) (emacs-lisp . t) (ruby . t) (R . t) (python . t) (C . t) (sh . t)))
There's an interesting detail. When I execute this code
#+SRC_BEGIN (write "hello") #+END_SRC
I get this output in the org file:
#+RESULTS: [blank here]
And another buffer with this:
=> #<unspecified> "hello world";; -*- geiser-scheme-implementation: guile -*- (write "hello world")
But the following program produces no output at all, not even the empty
#+RESULT: block, except for a new guile REPL with nothing loaded into it.
This is the program (from SICP):
#+NAME rules #+BEGIN_SRC scheme :tangle yes :noweb yes (define (deriv exp var) (cond ((constant? exp var) 0 ) ((same-var? exp var) 1) ((sum? exp) (make-sum (deriv (A1 exp) var) (deriv (A2 exp) var))) ((product? exp) (make-sum (make-product (M1 exp) (deriv (M2 exp) var)) (make-product (deriv (M1 exp) var) (M2 exp)))))) #+END_SRC #+BEGIN_SRC scheme :tangle yes :noweb yes (define atom? (lambda (x) (and (not (pair? x)) (not (null? x))))) (define (constant? exp var) (and (atom? exp) (not (eq? exp var)))) (define (same-var? exp var) (and (atom? exp) (eq? exp var))) (define (sum? exp) (and (not (atom? exp)) (eq? (car exp) '+))) (define (make-sum a1 a2) (list '+ a1 a2)) (define A1 cadr) ;;TODO rewrite these as lambda expressions (lambada (x) (car (cdr x)). something like that. (define A2 caddr) (define (product? exp) (and (not (atom? exp)) (eq? (car exp) '*))) (define (make-product m1 m2) (list '* m1 m2)) (define M1 cadr) (define M2 caddr) (define foo '(+ (* a (* x x)) (* (* b x) c))) <<rules>> (deriv foo 'x) #+END_SRC
Can someone tell me why the program isnt executed and instead a guile REPL is opened for some reason?