emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Org-Babel - Clojure & Lazy Sequences Bug


From: Eric Schulte
Subject: Re: [Orgmode] Org-Babel - Clojure & Lazy Sequences Bug
Date: Fri, 26 Nov 2010 15:49:55 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Rick Moynihan <address@hidden> writes:

>
> Basically it looks like the different :results types haven't yet been
> implemented...  The one I was missing was 'code'  e.g. the following
> works for elisp:
>
> #+begin_src emacs-lisp :results code
>   '(+ 10 1)
> #+end_src
>
> displaying:
>
> #+results:
> #+BEGIN_SRC emacs-lisp
> (+ 10 1)
> #+END_SRC
>
> But in clojure I get:
>
> #+begin_src clojure :results code
>   '(+ 10 1)
> #+end_src
>
> #+results:
> | + | 10 | 1 |
>

I've just pushed up an implementation of this feature.  It uses
Clojure's pretty printer which has different settings for printing code
and data.  This can be controlled through use of the "code" (for code)
and "pp" (for data) arguments to :results, here's example output with
the new implementation.

#+begin_src clojure :results pp
  '(defn cl-format 
     "An implementation of a Common Lisp compatible format function"
     [stream format-in & args]
     (let [compiled-format (if (string? format-in) (compile-format format-in) 
format-in)
           navigator (init-navigator args)]
       (execute-format stream compiled-format navigator)))
#+end_src

#+results:
#+begin_example
(defn
 cl-format
 "An implementation of a Common Lisp compatible format function"
 [stream format-in & args]
 (let
  [compiled-format
   (if (string? format-in) (compile-format format-in) format-in)
   navigator
   (init-navigator args)]
  (execute-format stream compiled-format navigator)))
#+end_example

#+begin_src clojure :results code
  '(defn cl-format 
     "An implementation of a Common Lisp compatible format function"
     [stream format-in & args]
     (let [compiled-format (if (string? format-in) (compile-format format-in) 
format-in)
           navigator (init-navigator args)]
       (execute-format stream compiled-format navigator)))
#+end_src

#+results:
#+BEGIN_SRC clojure
(defn cl-format
  "An implementation of a Common Lisp compatible format function"
  [stream format-in & args]
  (let [compiled-format (if (string? format-in)
                          (compile-format format-in)
                          format-in)
        navigator (init-navigator args)]
    (execute-format stream compiled-format navigator)))
#+END_SRC



reply via email to

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