Here's a code block in org-mode:

#+name:myflatten1
#+begin_src scheme :session f1
(define (flatten sexpr)
  (let loop ((sexpr sexpr)
             (res '()))
             (format #t "sexpr: ~s; res: ~s\n" sexpr res)
    (cond
     ((null? sexpr) res)
     ((pair? sexpr)
      (append (flatten (car sexpr)) (flatten (cdr sexpr))))
     (else
      (cons sexpr res)))))
#+end_src

Now, had I done this in elisp I'd be able to call it somewhere else in my
org-mode world by its babel code-block name -- and throw in lots of other
variables and such and then activate/call it in a REPL session outside of
another Scheme function. AFAIK, only elisp has this ability in org-mode. It
may seem a minor thing, but it adds a new level of meta/modular, IMHO. For
example, the org-mode literal programming paradigm is a real improvement
(again IMHO) over traditional "tangle," especially if you don't have to
pull all the code out and deal with it separately. You can call up code
blocks on the fly. Could geiser learn to do this elisp trick?

Larry Bottoff

Reply via email to