How can I test that every value in the collection returned by map
is true?
I am using the following:
(defn test [f coll]
(every? #(identity %) (map f coll)))
with the anonymous function #(identity %)
, but I was wondering if there is a better way.
I cannot use (apply and ...)
because and
is a macro.
UPDATE: BTW, I am making my way through The Haskell Road to Logic, Maths, and Programming, by Kees Doets and Jan can Eijck, but doing the exercises in Clojure. It's a very interesting book.
either
(every? identity (map f coll))
or
(every? f coll)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With