How can I eval something a second time while keeping the lexical context?
* (defvar form '(+ 1 2))
form
* form
(+ 1 2)
* (eval form) ;; This loses the lexical scope (not an issue here)
3
For an example of the problem where the lexical scope is needed
(let ((a 1) (b 2)
(form '(+ a b)))
(print form)
(print (eval form)) )
(+ a b)
The variable A is unbound.
How do I eval that form twice in the same lexical scope?
How do eval as many times I as want (in the same lexical scope)?
Related to a previous question Why does SBCL eval function lose the macrolet it's running in?
evaldoesn't let you evaluate a form in any but the null lexical environment. What do you mean by "eval twice"? You can certainly applyevalto the result of a call toeval, but I doubt that's what you mean? Can you show an example of what you'd like to be able to do, and explain how it "evals twice"?