On 03.03.2009, at 01:01, Stephen C. Gilardi wrote:

> The seq function is not able to provide a seq on either an  
> Enumeration or an Iterator.
>
> clojure.core provides enumeration-seq and iterator-seq to create  
> seqs on them.

Yesterday I added a generic anything-to-seq multimethod to  
clojure.contrib. It should be straightforward to add implementations  
for Enumeration and Iterator, which would look like this:

(require 'clojure.contrib.seq-utils)

(defmethod clojure.contrib.seq-utils/seq-on java.lang.Enumeration
   [e]
   (clojure.lang.EnumerationSeq/create e))

(defmethod clojure.contrib.seq-utils/seq-on java.util.Iterator
   [iter]
   (clojure.lang.IteratorSeq/create iter))

Unfortunately I don't know enough about Java to know how to add the  
necessary import statements, or how to generate Enumeration and  
Iterator objects for testing this. If anyone is willing to help with  
this, I'd happily add the two implementations to clojure.contrib.seq- 
utils.

Konrad.


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