From 9bce1a52cd2a6ac7c2bb3c3bed57b8f39b9dfc86 Mon Sep 17 00:00:00 2001 From: Rich Hickey Date: Tue, 24 Jun 2008 14:35:16 +0000 Subject: fixed reduce retaining seq --- src/boot.clj | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/boot.clj b/src/boot.clj index 73ae5341..e3d42473 100644 --- a/src/boot.clj +++ b/src/boot.clj @@ -456,10 +456,10 @@ (let [s (seq coll)] (when (instance? clojure.lang.IReduce s) (. #^clojure.lang.IReduce s (reduce f val))) - (loop [f f val val s s] - (if s - (recur f (f val (first s)) (rest s)) - val))))) + ((fn [f val s] + (if s + (recur f (f val (first s)) (rest s)) + val)) f val s)))) (defn reverse "Returns a seq of the items in coll in reverse order. Not lazy." @@ -1346,6 +1346,11 @@ not-every? (comp not every?)) (send agent count-down)) (. latch (await)))) +(defn await1 [#^clojure.lang.Agent a] + (when (pos? (.getQueueCount a)) + (await a)) + a) + (defn await-for "Blocks the current thread until all actions dispatched thus far (from this thread or agent) to the agents have occurred, or the -- cgit v1.2.3-70-g09d2