I want to write a function that would return the boolean true if the given collection is not empty and false otherwise.
I could either do
defn ..
(boolean (seq coll))
or
defn ..
(not (empty? coll))
As I am new to clojure I was initially inclined to go with #2 (more readable), but the clojure api reference for empty?
explicitly says use the idiom (seq coll)
instead of (not (empty? coll))
, maybe to avoid double negation.
I want to know what is the clojure way to check if a collection is non-empty and return a boolean true/false.