I find myself in need a function that is similar to some-fn
but combines predicates that take multiple arguments.
The new function should take a set of predicates and return a function f
. The function f
should return the first logical true value returned by one of its composing predicates applied to all of f
's arguments, or else logical false. So I should be able to do this:
((some-fn* < >) 1 2)
=> truthy
((some-fn* < >) 1 1)
=> falsey
It's easy enough to implement:
(defn some-fn* [& fs]
(fn [& args] (loop [fs fs]
(when (seq fs)
(or (apply (first fs) args)
(recur (rest fs)))))))
But it seems like such a simple thing should already exist in clojure.core. Does it? Or is there a simpler way to achieve what I need?