From: Kostruba
Subject: Lisp question
Date: 
Message-ID: <3931@ucsbcsl.ucsb.edu>
I have a Lisp question. In the following sequence...

(defun proveassert (assert)
	(let ((simpred nil)  answer)
	(mapcar '(lambda (z)  (setq simpred (cons (eval z) simpred))) assert)
                          .
                          .
                          .

where assert is a list, the Lisp interpreter is breaking at setq with the error
"simpred unbound signaled by setq" inside mapcar.

Why would simpred be unbound?

Thank you

::::::::::::::::::::::::::::::::::::::::::::::
····@cs.ucsb.edu
::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::
····@cs.ucsb.edu
::::::::::::::::::::::::::::::::::::::::::::::
From: Michael Greenwald
Subject: Re: Lisp question
Date: 
Message-ID: <michaelg.702074469@Xenon.Stanford.EDU>
····@lime.ucsb.edu (Kostruba) writes:

>I have a Lisp question. In the following sequence...

>(defun proveassert (assert)
>	(let ((simpred nil)  answer)
>	(mapcar '(lambda (z)  (setq simpred (cons (eval z) simpred))) assert)
>                          .

>where assert is a list, the Lisp interpreter is breaking at setq with the error
>"simpred unbound signaled by setq" inside mapcar.

>Why would simpred be unbound?

Because you quoted the lambda form, perhaps?  Use #' instead.  When
you quote the lambda expression it isn't evaluated until it is inside
the call to mapcar, at which point the body is no longer in the
lexical environment of the proveassert.