puzzle about EVAL and INTERN

Discussion of Common Lisp

puzzle about EVAL and INTERN

Postby 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))
[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?


Re: puzzle about EVAL and INTERN

Postby 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/
Posts: 440
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX

Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 8 guests