On Aug 19, 12:27 pm, Stuart Sierra <[EMAIL PROTECTED]> wrote: > Not sure what's going on here. It appears that calling map on an > Iterator skips the second item, unless you call seq on the Iterator > first. > -Stuart > > user=> (def a (new java.util.ArrayList)) > #'user/a > user=> (doseq n (range 1 5) (.add a n)) > nil > user=> (seq a) > (1 2 3 4) > user=> (seq (.iterator a)) > (1 2 3 4) > user=> (map inc a) > (2 3 4 5) > user=> (map inc (.iterator a)) > (2 4 5) > user=> (map inc (seq (.iterator a))) > (2 3 4 5) Yes, I can't support implicit seq on Iterators or Enumerations as I have been, due to the fact that code (such as map's) might incidentally create multiple seqs on the same mutable iterator. So, I've removed implicit seq support for Iterators and Enumerations, and added iterator-seq and enumeration-seq explicit constructor functions. Note that most collections providing iterators implement Iterable and thus support seq directly. Also, FYI, most Java collections such as ArrayList support construction from collections, and thus one-step initialization from Clojure data structures, so 'a' above can be created like this: (def a (java.util.ArrayList. (range 1 5))) Thanks for the report, 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 -~----------~----~----~----~------~----~------~--~---