clojure.core/some¶
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)
Examples¶
Note by Sgeo¶
Be careful about using sets as predicates if you don't know what is in the set. In particular,
(#{nil} nil) is niland
(#{false} false) is falseConsider using
contains?instead.
See also¶
- clojure.core/every? (3)
- clojure.core/not-any?
- clojure.core/keep (8)
- clojure.core/keep-indexed (5)
- clojure.core/some-fn (2)
- clojure.core/some-> (0)
- clojure.core/contains? (2)
- clojure.core/some? (4)
- clojure.core/if-some
- clojure.core/when-some (3)
Content from the matching ClojureDocs page, with authors credited on each contribution.