LFE eval func ?

16 views
Skip to first unread message

subhrendu Sarkar

unread,
Mar 27, 2015, 3:17:47 AM3/27/15
to lisp-flavo...@googlegroups.com
doing 
(eval "(+ 2 2)")

gives "(+ 2 2)"
isnt a string inherently a list and hence an S-expr ?
Why does this require conversion from string to Expressions ? 
Any reason this was done this way ?

Robert Virding

unread,
Mar 27, 2015, 3:26:22 AM3/27/15
to lisp-flavo...@googlegroups.com
Yes, a string is a list, but it is a list of characters and not an expression. Eval takes an expression, so:

(eval '(+ 2 2))  ==> 4

A string which is a list of characters (integers) is specially treated and not handled as a call to be evaluated so it does not need to be quoted. Otherwise the string "hello" would result in a call to the "function" 104.

LFE does not do any automatic conversion of arguments.

Robert
Reply all
Reply to author
Forward
0 new messages