How to convert arguments list to string of each on new line in Emacs Lisp?

I want to get list to :var into emacs-lisp code block in Emacs Org-mode and to output just each of list item on new line. In ruby it looks as simple as

#+BEGIN_SRC ruby 
[1,2,3,4]*"\n"
#+END_SRC

But cannot realise how to do it in Emacs lisp code block.

1 answer

  • answered 2017-11-13 10:57 phils

    Something like this?

    #+BEGIN_SRC emacs-lisp
    (mapconcat #'number-to-string '(1 2 3 4) "\n")
    #+END_SRC
    
    #+RESULTS:
    : 1
    : 2
    : 3
    : 4