4 ms·
You can see how an expression is read this way: (defun how-is-it-read? (string) (write-to-string (read-from-string string) :pr
by bluefox 10y ago
You can see how an expression is read this way:
(defun how-is-it-read? (string)
(write-to-string (read-from-string string)
:pretty nil))
==> HOW-IS-IT-READ?
(how-is-it-read? "#'foo")
==> "(FUNCTION FOO)"
(how-is-it-read? "(remove-if-not #'evenp '(1 2 3 4 5 6 7 8 9 10))")
==> "(REMOVE-IF-NOT (FUNCTION EVENP) (QUOTE (1 2 3 4 5 6 7 8 9 10)))"
You can see that this does not match your expectation. Are you actually trying to type that code and evaluate it at a Lisp listener? If not, you should.
Now, FUNCTION is a special operator that in this case returns the function named EVENP.
QUOTE is a special operator that just returns the object it is passed.
So REMOVE-IF-NOT will get called with two arguments: the function named EVENP, and a list of integers from 1 to 10.