emacs-orgmode
[Top][All Lists]
Advanced

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

Re: appearance of list as results from evaluating code blocks


From: Johannes Brauer
Subject: Re: appearance of list as results from evaluating code blocks
Date: Thu, 24 Jun 2021 17:47:39 +0000

Hi John!

There is no „return“ in Lisp languages. The return value of (list 1 2 3) is (1 2 3). Clojure is a Lisp language similar to Elisp. So 

#+begin_src clojure :results code
(list 1 2 (+ 1 2))
  #+end_src

should work for Clojure as it does für Elisp.

Johannes

Am 24.06.2021 um 18:28 schrieb John Kitchin <jkitchin@andrew.cmu.edu>:

That probably means the clojure block is returning nil as the value. I don't know what it means to return something in clojure, but here is what you have to do with Python, for example.

#+BEGIN_SRC python :results value code
[1, 2, 3]
#+END_SRC

#+RESULTS:
#+begin_src python
None
#+end_src

You have to explicitly return a value to see it.

#+BEGIN_SRC python :results value code
return [1, 2, 3]
#+END_SRC

#+RESULTS:
#+begin_src python
[1, 2, 3]
#+end_src


John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803


On Thu, Jun 24, 2021 at 10:31 AM Johannes Brauer <brauer@nordakademie.de> wrote:
What about :results code
The default is a elisp code block so you get syntax coloring

That works fore lisp:

  #+begin_src elisp :results code
(list 1 2 (+ 1 2))
  #+end_src

  #+RESULTS:
  #+begin_src elisp
  (1 2 3)
  #+end_src

But with Clojure I get

  #+begin_src clojure :results code
(list 1 2 (+ 1 2))
  #+end_src

  #+RESULTS:
  #+begin_src clojure
  nil
  #+end_src



reply via email to

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