First we build a set of all the keys in *list-b*:
(into #{} (map key-fn list-b))
Let's call that set *keyset-b. *Then we use *keyset-b* as a function which
returns truthy (non-nil) for any key that is contained in it, and compose
it with our *key-fn*:
(comp keyset-b key-fn)
This results in a function that first applies *key-fn*, then *keyset-b*. So
it's like #(keyset-b (key-fn %)). Let's call this function *predicate*.
Finally, we use *predicate* to *remove* any member of *list-a* for which it
is truthy:
(remove predicate list-a)
-marko
On Thursday, March 21, 2013 4:14:46 PM UTC+1, Ryan wrote:
> Marko,
>
> Can you please do me a favor and break down the function you suggested me?
> I understand partially how it works but I am having trouble to fully get it.
>
> (remove (comp (into #{} (map key-fn list-b)) key-fn) list-a)
>>
>
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.