LISP: with predicate as parameter
问题 I want a predicate as a parameter of a function. (DEFUN per (F L) (cond ((F L) 'working) (T 'anything))) (per 'numberp 3) as result it raises an error: Undefined operator F in form (F L). 回答1: As explained in Technical Issues of Separation in Function Cells and Value Cells, Common Lisp is a Lisp-2, i.e., you need funcall: (defun per (F L) (if (funcall F L) 'working 'other)) (per #'numberp 3) ==> WORKING (per #'numberp "3") ==> OTHER See also apply. 回答2: Late to the party, but here's another