Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread stu
Hi, I'd like to make use of Java classes implementing the Java2D PathIterator interface: http://download.oracle.com/javase/6/docs/api/java/awt/geom/PathIterator.html Which leads to a serious impedance mismatch between immutable Clojure data structures and the iterator's approach of calling

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread Jonathan Fischer Friberg
Maybe this would do: https://gist.github.com/1073506 I should add that I have never used iterators, and that the code is untested ;) Jonathan On Sat, Jul 9, 2011 at 11:10 AM, stu stuart.hungerf...@gmail.com wrote: Hi, I'd like to make use of Java classes implementing the Java2D

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread David Powell
On Sat, Jul 9, 2011 at 10:10 AM, stu stuart.hungerf...@gmail.com wrote: Hi, I'd like to make use of Java classes implementing the Java2D PathIterator interface: http://download.oracle.com/javase/6/docs/api/java/awt/geom/PathIterator.html Which leads to a serious impedance mismatch

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread Jonathan Fischer Friberg
I don't think I like the notion of a lazy-seq and an iterator, since reading the iterator also changes it. Consider the case where you create a lazy-seq from an iterator, and the iterator somehow escapes. Somewhere else the iterator is read from, and now the data that where supposed to be in the

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread Stuart Halloway
I don't think I like the notion of a lazy-seq and an iterator, since reading the iterator also changes it. Consider the case where you create a lazy-seq from an iterator, and the iterator somehow escapes. Somewhere else the iterator is read from, and now the data that where supposed to be

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread Jonathan Fischer Friberg
Well, I guess. But I get the feeling that the iterator are probably coming from some java object somewhere, and might get passed around in that environment, that's why I'm worried. In the examples you mentioned, line-seq for example. The reader has already 'escaped' since it is passed as an