Re: Predicate problem

2011-08-02 Thread Petr Gladkikh
On Tue, Aug 2, 2011 at 4:27 PM, Stefan Kamphausen wrote: > Hi, > > can't you just use the set itself as the function determining whether the > items contains the ID. Set-as-function was the first thing I tried but it did not work either. Based on my tweaking, type mismatch is more likely the prob

Re: Predicate problem

2011-08-02 Thread Stefan Kamphausen
Hi, can't you just use the set itself as the function determining whether the items contains the ID. The following example uses just a vector of maps for the new-states and thus uses -> instead of .. but it seems to work user=> (def pinned-ids #{200, 210}) #'user/pinned-ids user=> (def new-

Re: Predicate problem

2011-08-02 Thread Oskar Kvist
I'm stupid today... I meant: (contains? #{(int 1)} (long 1)) false On Aug 2, 10:19 am, Oskar Kvist wrote: > Btw, that should be fixed in 1.3 I think. > > On Aug 2, 10:18 am, Oskar Kvist wrote: > > > > > > > > > Sorry, didn't read your post properly. Maybe it's because the ints are > > of differ

Re: Predicate problem

2011-08-02 Thread Oskar Kvist
Btw, that should be fixed in 1.3 I think. On Aug 2, 10:18 am, Oskar Kvist wrote: > Sorry, didn't read your post properly. Maybe it's because the ints are > of different types. > > (contains? [(int 1)] (long 1)) > false > > On Aug 2, 10:13 am, Oskar Kvist wrote: > > > > > > > > > "Returns true if

Re: Predicate problem

2011-08-02 Thread Oskar Kvist
Sorry, didn't read your post properly. Maybe it's because the ints are of different types. (contains? [(int 1)] (long 1)) false On Aug 2, 10:13 am, Oskar Kvist wrote: > "Returns true if _key_ is present in the given collection, otherwise > returns false." > > For sets like #{200, 210} the values

Re: Predicate problem

2011-08-02 Thread Oskar Kvist
"Returns true if _key_ is present in the given collection, otherwise returns false." For sets like #{200, 210} the values also count as keys. On Aug 2, 10:10 am, Petr Gladkikh wrote: > I spent hour already and can not understand what is wrong here. > > I want to filter collection based on a nest

Predicate problem

2011-08-02 Thread Petr Gladkikh
I spent hour already and can not understand what is wrong here. I want to filter collection based on a nested field of collection element having some value: (println pinned-ids) ; #{200, 210} (println (contains? pinned-ids 200)) ; true (println (map #(.. % :field :id) new-states)) ; (10 20 21 1