Hi,

I am very new to Clojure and I am trying to turn a <a href="http://
www.biojava.org/docs/api/org/biojava/bio/seq/SequenceIterator.html">SequenceIterator</a>
from the BioJava library into a lazy Clojure seq.

The interface has two methods `hasNext()` and `nextSequence()` which
have very similar semantics to `hasNext()` and `next()` for the
standard Java Iterator interface.

I have looked into various seq related commands like `while`, `doseq`,
`for` but cannot seem to find the right combination to wrap
SequenceIterator so that it will lazily return the next item in a
sequence until `hasNext()` is false.

The closest I've got is:

      (repeatedly #(.nextSequence sequenceiterator))

which unfortunately throws when `hasNext()` is false.

Any help would be greatly appreciated.

Regards,

Mark

PS. Just so there is no confusion, the word Sequence in Sequence
iterator has nothing to do with Clojure's seqs - read
"SequenceIterator" as "ThingIterator" if it will make it easier.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
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