CL-USER> (defun disjoin (fn &rest fns)
(if (null fns)
fn
(let ((disj (apply #'disjoin fns)))
#'(lambda (&rest args)
(or (apply fn args) (apply disj args))))))
DISJOIN
CL-USER> (funcall (disjoin #'< #'=) 3 5)
T
CL-USER> (funcall (disjoin #'< #'=) 5 3)
NIL
CL-USER> (funcall (disjoin #'< #'=) 3 3)
T
재귀적(recursive) 사고에 익숙하지 않다면 이해하는게 고역일 수도 있다.
당연히 conjoin은 or을 and로 바꾸기만 하면 된다.




덧글