Clojure itself is being pragmatic about many many things... If you want removeAll() then use it...what can be better than a single method call?

mind you though, what Andy said applies here. It depends what you want to compare for...you want to do a 'deep' comparison (per =) or fall back to java's broken equality semantics? If you use removeAll() you automatically lose the ability to make such decisions for yourself... :-)


Jim


On 11/03/13 19:35, Ryan wrote:
Hey Jim,

Thanks for your replies for starters.

Indeed I do not care what will happen to the original lists, i only care to find out which objects from list A do not exist in list B. Ignore the key part. I was aware of the functionality which is provided by java.util.List but I was hoping for a more clojurish way instead of calling java methods.

or is it pointless and I should just use removeAll()?

Ryan

On Monday, March 11, 2013 8:49:45 PM UTC+2, Jim foo.bar wrote:

    On 11/03/13 18:35, Jim - FooBar(); wrote:
    > 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.

    actually there is a removeAll(Collection c) which will
    (destructively)
    give you exactly what you want...I guess that would be the fastest
    way
    if you don't care about what happens to list A...

    hope that helps,

    Jim

--
--
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.


Reply via email to