diff options
author | Drew Raines <aaraines@gmail.com> | 2009-08-20 22:26:16 -0500 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2009-11-24 07:56:14 -0500 |
commit | 284ee8aa7c81c4def1fd6808a4d80f5c0e5829e4 (patch) | |
tree | cd656430b5ca383182072ad5c14d98cea1c761ef | |
parent | 841dc9c9df717ee665b95e9471dc5e01b5c113eb (diff) |
*-seq should return nil if the LazySeq is empty.
Signed-off-by: Rich Hickey <richhickey@gmail.com>
-rw-r--r-- | src/clj/clojure/core.clj | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index 9c074092..d6fd24f1 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -1955,10 +1955,9 @@ "Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader." [#^java.io.BufferedReader rdr] - (lazy-seq - (let [line (. rdr (readLine))] - (when line - (cons line (line-seq rdr)))))) + (let [line (. rdr (readLine))] + (when line + (lazy-seq (cons line (line-seq rdr)))))) (defn comparator "Returns an implementation of java.util.Comparator based upon pred." @@ -3198,11 +3197,10 @@ using java.util.regex.Matcher.find(), each such match processed with re-groups." [#^java.util.regex.Pattern re s] - (let [m (re-matcher re s)] - ((fn step [] - (lazy-seq - (when (. m (find)) - (cons (re-groups m) (step)))))))) + (let [m (re-matcher re s)] + ((fn step [] + (when (. m (find)) + (lazy-seq (cons (re-groups m) (step)))))))) (defn re-matches "Returns the match, if any, of string to pattern, using @@ -3790,9 +3788,8 @@ row-struct (apply create-struct keys) row-values (fn [] (map (fn [#^Integer i] (. rs (getObject i))) idxs)) rows (fn thisfn [] - (lazy-seq - (when (. rs (next)) - (cons (apply struct row-struct (row-values)) (thisfn)))))] + (when (. rs (next)) + (lazy-seq (cons (apply struct row-struct (row-values)) (thisfn)))))] (rows))) (defn iterator-seq |