I\'m learning Lisp from the book \'Practical Common Lisp\'. At one point, I\'m supposed to enter the following bit of code:
[1] (remove-if-not #\'evenp \'(1
This is not CLISP specific, it works in every Common Lisp implementation (I use Clozure Common Lisp here).
What happens is that if you give a symbol as a function designator then the implementation will look up the symbol-function
(assuming the symbol is available in the global environment) for you:
? #'evenp
#
? (symbol-function 'evenp)
#
In general you can use either, but there's an interesting effect if you rebind the called function later. If you specify the function (#'
or (function)
) then the calls will still call the old function because the lookup has been done at compile time; if you use the symbol then you will call the new function because the lookup is re-done at runtime. Note that this may be implementation-specific.