Function: CONJOIN

Source

(defun conjoin (&rest predicates)
  (case (length predicates)
    (0 (constantly t))
    (1 (car predicates))
    (2 (lambda (&rest args)
         (and (apply (first predicates) args)
              (apply (second predicates) args))))
    (3 (lambda (&rest args)
         (and (apply (first predicates) args)
              (apply (second predicates) args)
              (apply (third predicates) args))))
    (t
     (lambda (&rest args)
       (loop
          for p in predicates
          for val = (apply p args)
          while val
          finally (return val))))))
Source Context