Barry Margolin <barmar@alum.mit.edu> wrote:
+---------------
| Since establishing restarts manipulates the stack, they need to expand
| into special operators. There aren't functional equivalents for the
| same reason that there's no functional equivalent to LET.
+---------------
Actually, isn't LET just syntactic sugar around LAMBDA?
> (defmacro my-let ((&rest bindings) &body body)
(let ((vars (mapcar #'car bindings))
(vals (mapcar #'cadr bindings)))
`((lambda ,vars ,@body) ,@vals)))
MY-LET
> (macroexpand-1
'(my-let ((x 2) (y 3))
(+ x (* y 5))))
((LAMBDA (X Y) (+ X (* Y 5))) 2 3)
T
> (my-let ((x 2) (y 3))
(+ x (* y 5)))
17
>
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607