REPL problems in Lisp

Discussion of Common Lisp

The REPL calls EVAL

Postby danb » Wed Dec 31, 2008 9:46 pm

The difference is that there are two evaluations in (eval '(a b)). When you type (eval '(a b)) into the repl, the call to READ in the repl turns the string '(a b) into the form (quote (a b)), and the call to EVAL (still in the repl) evaluates the quote form and returns the list (a b). Now your explicit call to EVAL is trying to call A as a function. When you type '(a b) into the repl, there's only one call to EVAL (the one in the repl).
danb
 
Posts: 35
Joined: Sat Jun 28, 2008 1:05 pm
Location: Urbana, Illinois, US

Re: REPL problems in Lisp

Postby aloyslisp » Wed Jan 07, 2009 11:08 pm

More precisely :

After testing in CLisp.

In (eval (read)), that's not the input that is evaluated but the (read) function.
Though
(eval (read)) with '(a b) -> (QUOTE (A B)) ; (READ) is evaluated : only macro-character transformation
but
(eval '(a b)) -> (eval (QUOTE (A B))) -> (A B) ; QUOTE function is evaluated

in consequence, the evaluation of arguments of the write will give different results :
(A B) in the first case
invalid function A error in the second

best regards

PS :
Textual and internal structure can be confusing. Macro-character transformation is not evaluation but input rewriting.
User avatar
aloyslisp
 
Posts: 7
Joined: Tue Dec 30, 2008 12:54 pm
Location: Lausanne Switzerland

Re: REPL problems in Lisp

Postby Wodin » Wed Jan 21, 2009 2:18 pm

aloyslisp wrote:As I just begin a nTh CL version in Java, I just crash on some problems.

See also http://common-lisp.net/project/armedbear/
Wodin
 
Posts: 56
Joined: Sun Jun 29, 2008 8:16 am

Previous

Return to Common Lisp

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 3 guests

cron