I am somewhat new to the CL and is currently trying to wrap my head around mapcan, #', funcalland closing. Here is a closure that applies the predicate to n and, if correct, returns (list n), else nil:
(defun all-those (predicate)
(lambda (n)
(if (funcall predicate n) (list n))))
I understand what I need to call funcallto turn this closure into a function. This works great:
> (funcall (all-those
(8)
Now I tried to pass the function created here as an argument to mapcan:
> (mapcan
I get a compile-time error: (FUNCALL (ALL-THOSE #'EVENP)) is not a legal function name.
But it works if I lower #'as wellfuncall:
> (mapcan (all-those
(2 4)
. , mapcan, (*), funcall, " ".
, #' funcall ? .
(*) , , . mapcan, : (mapcan #'(lambda ...