puzzle about EVAL and INTERN

Discussion of Common Lisp
Post Reply
nobodxbodon

puzzle about EVAL and INTERN

Post by nobodxbodon » Sun Mar 22, 2009 2:31 pm

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!

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

Re: puzzle about EVAL and INTERN

Post by findinglisp » Mon Mar 23, 2009 8:56 am

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/

Post Reply