Experiment on interative ielm
ELISP> (print 'list) list list ELISP> (print "list") "list" "list"
Any differences with the two results? by the way, one extra times printed.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
"list" are different datatypes:
ELISP> (type-of 'list) symbol ELISP> (type-of "list") string
Note that they even show up differently in your example -- it's the difference between
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:
ELISP> 3 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" not-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.