Menu

#19 Defun as an argument

Lisp
open
nobody
Defect (22)
5
2009-02-13
2009-02-13
No

defun returns an agent and (eval agent) executes an agent.  Consider the following:
eval (lambda () (pi)))   ;; => 3.14159265359
which works correctly.  Now consider
(eval (defun foo() (pi)))
which returns an arglist error. Now consider
(defun foo() (pi))
(eval foo)     ;; => 3.14159265359
works as expected.  The compiler is passing the wrong variable to eval for evaluation when defun is the argument.

Discussion


Log in to post a comment.