-;;;; utilities
-
-;;; sort of like ANY and EVERY, except:
-;;; * We handle two-VALUES predicate functions like SUBTYPEP. (And
-;;; if the result is uncertain, then we return (VALUES NIL NIL).)
-;;; * THING is just an atom, and we apply OP (an arity-2 function)
-;;; successively to THING and each element of LIST.
-(defun any/type (op thing list)
- (declare (type function op))
- (let ((certain? t))
- (dolist (i list (values nil certain?))
- (multiple-value-bind (sub-value sub-certain?)
- (funcall op thing i)
- (unless sub-certain? (setf certain? nil))
- (when sub-value (return (values t t)))))))
-(defun every/type (op thing list)
- (declare (type function op))
- (dolist (i list (values t t))
- (multiple-value-bind (sub-value sub-certain?)
- (funcall op thing i)
- (unless sub-certain? (return (values nil nil)))
- (unless sub-value (return (values nil t))))))