Where by now:
(defn lazy-reader [fl]
(assert ...)
(lazy-seq
(cons (.read fl) (lazy-reader fl))))
The first one ?
This means that I haven't understand nothing, right?
(I'm so sorry for this stupid question... :embarassed: )
On Dec 13, 10:23 pm, Cedric Greevey <[email protected]> wrote:
> On Tue, Dec 13, 2011 at 11:12 PM, Simone Mosciatti <[email protected]> wrote:
> > Ok, now by now i think to have understand...
>
> > To do right, I should build a macro similar to let where I pass the
> > filename and after execute the body close the stream, right ?
>
> Easier to just use the pre-existing one: with-open.
>
> Something like:
>
> (with-open [rdr (clojure.java.io/reader foo)]
> (reduce something (filter whatever (transmogrify (lazy-reader rdr)))))
>
> will auto-close rdr after the reduction is done, and evaluate to the
> result of the reduction.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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