On Mar 26, 1:10 am, Stuart Sierra <[email protected]> wrote:
> Hi Mark,
> You'll need to work at a lower level using cons and lazy-seq.
> Something like this (untested):
>
> (defn bio-iterator-seq [iterator]
>   (lazy-seq
>     (when (.hasNextiterator)
>       (cons (.nextSequenceiterator) (bio-iterator-seqiterator)))))

Hi Stuart,

Thanks for that. Once I upgraded my clojure.jar to the latest release
that code worked perfectly.

Calling

   (def input (BufferedReader. (FileReader. "data/dm4p1/dm4p1.dEID")))
   (def data (RichSequence$IOTools/readFastaDNA input nil))
   (doseq [d (bio-iterator-seq data)] (prn 'Sequence (show d)))

Printed all the sequences from the file, as required.

Just to be sure, is `doseq` the correct way to pull items from a lazy
sequence like this?

Thanks again for your help,

Mark
--
http://mark.reid.name
--~--~---------~--~----~------------~-------~--~----~
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