(defun build-comparator (eql &key < >) (if (and (not <) (not >)) (error "needs < or > key") (lambda (v1 v2) (cond ((funcall eql v1 v2) 'equals) (< (if (funcall < v1 v2) 'less-than 'greater-than)) (> (if (funcall > v1 v2) 'greater-than 'lesser-than))))))Source Context