(every-pred p)
(every-pred p1 p2)
(every-pred p1 p2 p3)
(every-pred 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.
Source
(defn
every-pred
"Takes a set of predicates and returns a function f that returns true if all of its\n composing predicates return a logical true value against all of its arguments, else it returns\n false. Note that f is short-circuiting in that it will stop execution on the first\n argument that triggers a logical false result against the original predicates."
([p]
(fn
ep1
([] true)
([x] (boolean (p x)))
([x y] (boolean (and (p x) (p y))))
([x y z] (boolean (and (p x) (p y) (p z))))
([x y z & args] (boolean (and (ep1 x y z) (every? p args))))))
([p1 p2]
(fn
ep2
([] true)
([x] (boolean (and (p1 x) (p2 x))))
([x y] (boolean (and (p1 x) (p1 y) (p2 x) (p2 y))))
([x y z] (boolean (and (p1 x) (p1 y) (p1 z) (p2 x) (p2 y) (p2 z))))
([x y z & args]
(boolean
(and
(ep2 x y z)
(every?
(fn* [p1__18649#] (and (p1 p1__18649#) (p2 p1__18649#)))
args))))))
([p1 p2 p3]
(fn
ep3
([] true)
([x] (boolean (and (p1 x) (p2 x) (p3 x))))
([x y] (boolean (and (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y))))
([x y z]
(boolean
(and
(p1 x)
(p2 x)
(p3 x)
(p1 y)
(p2 y)
(p3 y)
(p1 z)
(p2 z)
(p3 z))))
([x y z & args]
(boolean
(and
(ep3 x y z)
(every?
(fn*
[p1__18650#]
(and (p1 p1__18650#) (p2 p1__18650#) (p3 p1__18650#)))
args))))))
([p1 p2 p3 & ps]
(let
[ps (list* p1 p2 p3 ps)]
(fn
epn
([] true)
([x] (every? (fn* [p1__18651#] (p1__18651# x)) ps))
([x y]
(every?
(fn* [p1__18652#] (and (p1__18652# x) (p1__18652# y)))
ps))
([x y z]
(every?
(fn*
[p1__18653#]
(and (p1__18653# x) (p1__18653# y) (p1__18653# z)))
ps))
([x y z & args]
(boolean
(and
(epn x y z)
(every? (fn* [p1__18654#] (every? p1__18654# args)) ps))))))))