4 ms·
Derp, of course it does because (funcall #'foo) evaluates "#'foo" every time it runs. You need to bind (or assign) the value for it to actually show the differ
by aidenn0 4y ago
Derp, of course it does because (funcall #'foo) evaluates "#'foo" every time it runs. You need to bind (or assign) the value for it to actually show the difference:
(defun bar () 3)
(defvar *the-fn* #'bar)
(defvar *the-sym* 'bar)
(defun foo ()
(funcall *the-fn*))
(defun baz ()
(funcall *the-sym*))
Then at the REPL:
CL-USER> (values (baz) (foo))
3
3
CL-USER> (defun bar () 2)
WARNING: redefining COMMON-LISP-USER::BAR in DEFUN
BAR
CL-USER> (values (baz) (foo))
2
3