Experiment on interative ielm

ELISP> (print 'list)


ELISP> (print "list")



Any differences with the two results? by the way, one extra times printed.

1 Answer 1


'list and "list" are different datatypes:

ELISP> (type-of 'list)
ELISP> (type-of "list")

Note that they even show up differently in your example -- it's the difference between list and "list".

But why do they show up twice? Well, because the REPL displays anything printed out, but also prints out the return value of the s-expression. For example:

3 (#o3, #x3, ?\C-c)
ELISP> "I'm being returned!"
"I'm being returned!"

So if we use progn, which runs all of its arguments and returns the last one, we can see the difference between a printed value and a returned one:

ELISP> (progn (print "I'm being printed") 'not-printed)

"I'm being printed"

ELISP> (progn 'not-printed (print "I'm being printed"))

"I'm being printed"

"I'm being printed"

See how in the first example, the printed value shows up, followed by the not printed one? 'not-printed only ever shows up because it's returned; in the second example, we don't see 'not-printed ever show up! We see "I'm being printed" twice -- first printed, then returned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.