This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-17
Channels
- # beginners (10)
- # boot (9)
- # cider (1)
- # cljs-dev (191)
- # clojure (77)
- # clojure-russia (4)
- # clojure-serbia (10)
- # clojure-spec (19)
- # clojure-uk (4)
- # clojurescript (16)
- # core-async (9)
- # cursive (1)
- # data-science (1)
- # datomic (3)
- # emacs (42)
- # graphql (2)
- # hoplon (38)
- # jobs (1)
- # jobs-discuss (18)
- # luminus (3)
- # lumo (20)
- # off-topic (9)
- # om (51)
- # parinfer (3)
- # pedestal (8)
- # re-frame (4)
- # reagent (7)
- # rum (9)
- # sql (9)
- # untangled (81)
What's the canonical way to find an element in a collection which satisfies a condition?
Like find the first element in a list which is greater than 5, or all of them for that matter
i'm used to ruby where there are built in things like detect
and any?
which are more task-specific to things like "give me the first matching" or "does at least one match?" or "do all elements match" or "drop elements that don't match" etc.
@victora: filter is the function to use for that, it will return only those items that satisfy your conditions
@victora the normal way to do that is (first (filter pred? ...))
- it's a perrenial surprise for people to find out there isn't something more specialized