| function | since v0.0-927 | Edit |
(some pred coll)Returns the first logical true value of (pred x) for any x in coll, else
nil.
A common idiom is to use a set as pred, for example this will return :fred if
:fred is in the sequence, otherwise nil: (some #{:fred} coll)
Returns the first logical true value of (pred x) for any x in coll,
else nil. One common idiom is to use a set as pred, for example
this will return :fred if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)(defn some
[pred coll]
(when-let [s (seq coll)]
(or (pred (first s)) (recur pred (next s)))))