On Oct 3, 10:48 am, Allen Rohner <[EMAIL PROTECTED]> wrote:
> > The main reason, which I discussed with Hans on IRC, is that they have
> > bad performance characteristics. Lists and vectors make for bad sets,
> > and alists make for bad maps, with linear lookup times. Clojure has
> > real sets and maps, with reader and library support.
>
> I ran into this problem last night actually, and maybe it could be
> solved with education. :-) Is there a good way to convert an arbitrary
> java.util.Collection into a clojure set?
>
> I was working with some java code that returned a
> java.util.Enumeration, and (set java-obj) was returning 'don't know
> how to create ISeq from:'. If it were easier to convert java
> collections into clojure, that would obviate at least some of my need
> for a contains? on list/vectors/seqs.
>
> The patch looks pretty easy. Rich, would you be amenable?
>

It is not necessary. All Java collections can already be turned in to
sets using set:

(set (java.util.ArrayList. [1 2 3 4 5 3 2]))
#{1 2 3 4 5}

Enumerations are not collections, but can be turned into seqs
(manually only) using enumeration-seq.

Rich

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

Reply via email to