Dear list members,
It seems that core.line-seq contains a small bug w.r.t. laziness. The
side effect (. rdr (readLine)) occurs before lazy-seq, so the sequence
created is not fully delayed. Fix attached.
Cheers,
Toralf
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index 1b691ba..aac9571 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -1669,8 +1669,8 @@
"Returns the lines of text from rdr as a lazy sequence of strings.
rdr must implement java.io.BufferedReader."
[#^java.io.BufferedReader rdr]
- (let [line (. rdr (readLine))]
- (lazy-seq
+ (lazy-seq
+ (let [line (. rdr (readLine))]
(when line
(cons line (line-seq rdr))))))