Skip to content

clojure.core/every-pred

View this page on ClojureDocs

Type: function Added: Clojure 1.3 Examples: 3 Runnable: 2
([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps])

Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical false result against the original predicates.

Examples

by devn on
by daveliepmann on . May have evaluation errors.
by daveliepmann on

Note by harold

Careful--every predicate with no arguments is considered true:

user> ((every-pred (constantly false)))
true
user> ((every-pred (constantly false)) 1)
false

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.