I have a collection like this.
[{:id 101 :name "A"}, {:id 102 :name "B"}, {:id 103 :name "C"}]
I want to retrieve the complete map using id. For ex, i want to find for id = 102. so my function should return me this.
{:id 102 :name "B"}
I have a collection like this.
[{:id 101 :name "A"}, {:id 102 :name "B"}, {:id 103 :name "C"}]
I want to retrieve the complete map using id. For ex, i want to find for id = 102. so my function should return me this.
{:id 102 :name "B"}
i'm able to find a way to do so.here is my answer
cljs.user=> (def ab [{:id 101 :name "A"}, {:id 102 :name "B"}, {:id 103 :name "C"}])
#'cljs.user/ab
cljs.user=> (some #(when (= (:id %) 102) %) ab)
{:name "B", :id 102}
cljs.user=>