emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Rick Moynihan <rick.moynihan@gmail.com>
Cc: emacs-orgmode@gnu.org, Joel Boehland <joel.boehland@evocomputing.com>
Subject: Re: Org-Babel - Clojure & Lazy Sequences Bug
Date: Fri, 26 Nov 2010 15:49:55 -0700	[thread overview]
Message-ID: <871v67lmy4.fsf@gmail.com> (raw)
In-Reply-To: <AANLkTi=mgfaAZFvY8qqf4BOcX2FTMkGdt1KqKSsTLF_d@mail.gmail.com> (Rick Moynihan's message of "Fri, 26 Nov 2010 20:53:10 +0000")

Rick Moynihan <rick.moynihan@gmail.com> 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	other threads:[~2010-11-26 22:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04 14:11 Org-Babel - Clojure & Lazy Sequences Bug Rick Moynihan
2010-11-06 17:58 ` Eric Schulte
2010-11-24  1:51   ` Rick Moynihan
2010-11-25 17:40     ` Eric Schulte
2010-11-25 18:31       ` Rick Moynihan
2010-11-26 20:29         ` Eric Schulte
2010-11-26 20:53           ` Rick Moynihan
2010-11-26 22:49             ` Eric Schulte [this message]
2010-11-27  8:27               ` Achim Gratz
2010-11-27 15:20                 ` Eric Schulte
2010-11-28 23:23                   ` Rick Moynihan
2010-11-29  3:59                     ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871v67lmy4.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=joel.boehland@evocomputing.com \
    --cc=rick.moynihan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).