summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-06-24 14:35:16 +0000
committerRich Hickey <richhickey@gmail.com>2008-06-24 14:35:16 +0000
commit9bce1a52cd2a6ac7c2bb3c3bed57b8f39b9dfc86 (patch)
tree473e6fbae44ec49cceb55d9698e955451d1547b6 /src
parent8e613118ff6757707ae26fcd102bec7273650628 (diff)
fixed reduce retaining seq
Diffstat (limited to 'src')
-rw-r--r--src/boot.clj13
1 files changed, 9 insertions, 4 deletions
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