<cl> (find-all-if #'(lambda (x) (not (oddp x))) '(1 2 3 4 5)) (2 4)のように指示できます.これを一般的に考えて, 述語の否定を調べる関数を用いたい場合のために 否定の関数を返す関数を考えます. 上の例では,奇数でないことを調べる関数を返すということです.そのように 引数で与えられるある述語の否定を返す関数をcomplementと呼ぶことにします.
<cl> (defun complement (x) #'(lambda (y) (not (funcall x y)))) COMPLEMENT <cl> (find-all-if (complement 'oddp) '(1 2 3 4 5)) (2 4) <cl> (remove-if 'oddp '(1 2 3 4 5)) (2 4) <cl> (remove-if (complement 'evenp) '(1 2 3 4 5)) (2 4) <cl> (find-all-if 'evenp '(1 2 3 4 5)) (2 4)このように関数を返す関数を用いるとremove-if-notなどのように,-if-notと 付けていた関数が-ifとcomplementという組合せで実現できるようになります.