Scribit Jonathon McKitrick dies 07/03/2007 hora 18:15:
I'd like to understand from a lisp standpoint why this works the way it does. What is it about the function operator #' that it only grabs the value of the symbol when first evaluated? Is there a 'hidden' closure operation?
No need for this. Each symbol has an associated reference to a function. The symbol-function operator just returns this reference. After calling it, changing the symbol's function to another one only makes that the function you just got a reference to is not referenced anymore by this symbol.
If you want a function that would change when the symbol is redefined, use the following instead of symbol-function:
(defun tracking-symbol-function (symbol) (lambda (&rest args) (apply (symbol-function symbol) args)))
Obviously there's an overhead when calling this one.
Quickly, Pierre