Well, java.util.List specifies a retainAll(Collection c) method which is
basically the intersection between the 2 collections (the Collection
this is called on and the argument). You are actually looking for the
'difference' but if you have the intersection and the total it's pretty
trivial to find the difference.
alternatively, you can pour the lists into 2 clojure sets and take their
proper difference (but this will remove duplicates as well)...
I'm not sure what you mean 'compare those lists based on a key' though...
Jim
On 11/03/13 18:15, Ryan wrote:
Hello,
I have two lists which contain java objects of the same class. I am
trying to find out if there is a clojure function which i can use to
compare those lists based on a key and return the objects from list A
that do not exist in list B.
Is there such a function in clojure? If not, what would be the most
elegant way to achieve it.
Thank you for your time
Ryan
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient
with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.