On Dec 15, 6:01 pm, "Brian Doyle" <brianpdo...@gmail.com> wrote:
> According to the docs the seq function should be able to take an
> enumeration,
> but here is what I see:
>
> user=> (seq (.elements (doto (java.util.Vector.) (.add "hello") (.add
> "world"))))
> java.lang.IllegalArgumentException: Don't know how to create ISeq
> from:  (NO_SOURCE_FILE:0)
>

If you really want to create a seq on an Enumeration you have to use
enumeration-seq. But there is no need to explicitly obtain
enumerations/iterators for Collections (and Vector implements
Collection):

(seq (doto (java.util.Vector.) (.add "hello") (.add "world")))
-> ("hello" "world")

Note also that Collections have constructors from Collections, and
Clojure vectors are Collections:

(seq (java.util.Vector. ["hello" "world"]))
-> ("hello" "world")

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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to