This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

puzzle about EVAL and INTERN

2 posts · 2038 views

As a newbie on Common Lisp with only experience with some homework in scheme, I'm trying out the "fun" functions like eval and intern. I can't understand why is below:

[33]> (eval (list (intern "+") 2 3))
5
[34]> (eval (list (intern "floor") 2 3))

*** - EVAL: undefined function |floor|
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of (FDEFINITION '|floor|).
RETRY :R2 Retry
STORE-VALUE :R3 Input a new value for (FDEFINITION '|floor|).
ABORT :R4 Abort main loop

Actually same error happens when I use some functions other than + - * /, is it because problems with package?

Thanks!

Re: puzzle about EVAL and INTERN

Try "(intern "FLOOR")". The standard reader converts all symbols to uppercase by default as they are read.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/