On Tue, Aug 2, 2011 at 4:27 PM, Stefan Kamphausen
<[email protected]> 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 problem as
Oskar suggested.
Thank you all for suggestions.
>
> 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-states [{:field {:id 200}
> :test 1}
> {:field {:id 10}
> :test 2}])
> #'user/new-states
> user=> new-states
> [{:field {:id 200}, :test 1} {:field {:id 10}, :test 2}]
> user=> (map #(-> % :field :id) new-states) ;; uses -> instead of ..
> (200 10)
> user=> (map #(pinned-ids (-> % :field :id)) new-states)
> (200 nil)
> user=> (filter #(pinned-ids (-> % :field :id)) new-states)
> ({:field {:id 200}, :test 1})
>
> (Don't know how formatting will get through googles interface; no preview
> button around)
>
>
> Cheers,
> Stefan
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
Petr Gladkikh
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en