Search code examples
clojurefunctional-programming

OR multiple filtering clojure


There is a function in clojure every-pred that checks for multiple filtering

(every-pred integer? pos?)

Is there any function that could check if the sequence has true for predicate1 or predicate2

(or predicate1? predicate2?)

Solution

  • I think you're looking for some-fn:

    (filter (some-fn predicate-1? predicate-2?) [x y z])
    

    Note that if you look up every-pred on ClojureDocs.org, some-fn is listed in the "See Also" section.