filter with a sequence of maps not working

2013-08-07 Thread Tilak Thapa
I'm new to clojure. I've return an utility function to filter a sequence of map by some key but it's not working. Here is the sample code - (def data [{:id 1 :b 2} {:id 3 :b 4} {:id 5 :b 6} {:id 7 :b 8}]) In real app this is a sequence of maps

Re: filter with a sequence of maps not working

2013-08-07 Thread Timo Mihaljov
On 07.08.2013 10:58, Tilak Thapa wrote: (defn get-data [ attrs] (let [grps data] (if (empty? attrs) grps (map #(select-keys % attrs) grps (filter #(= (% :id) 7) (get-data :id :b)) Why above expression works but same expression wrapped as function (below) does