All this will do for you is give you a way to compute intersections
that is O(N) instead of O(logN).

If you don't care about performance, just (defn intersect [a b]
(clojure.set/intersection (set a) (set b))).
If you care about performance and plan to work with something as a set
later, then make it a set to begin with.
If you care about the *order* of the entries in one of your sets (it
makes no sense to care about order in both of them), then you can
(defn ordered-intersect [a b] (filter (set b) a)).


On Mar 13, 3:17 am, Christian Schuhegger
<christian.schuheg...@gmail.com> wrote:
> Hi all,
>
> I am coming from common lisp and was wondering if clojure supports
> intersection and union not only on sets, but also on normal sequences/
> lists? I just did a google search but without a result. For the moment
> I'm writing those functions myself.
>
> Thanks for any hints,
> Christian

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

Reply via email to