More idiomatic looping
This commit is contained in:
parent
1118b012f1
commit
492b5393a1
|
@ -13,18 +13,14 @@
|
||||||
(defn post-event [event]
|
(defn post-event [event]
|
||||||
(post-event-to *evq* event))
|
(post-event-to *evq* event))
|
||||||
|
|
||||||
(defn handle-next-event [evq & dispatchersInit]
|
(defn handle-next-event [evq & dispatchers]
|
||||||
(dosync (let [queueold @evq]
|
(dosync (let [queueold @evq]
|
||||||
(if (seq queueold)
|
(if (seq queueold)
|
||||||
(let [queuenew (pop queueold) event (peek queueold)]
|
(let [queuenew (pop queueold) event (peek queueold)]
|
||||||
(loop [dispatchers dispatchersInit]
|
(doseq [dispatcher dispatchers]
|
||||||
(if (seq dispatchers)
|
(dispatcher event))
|
||||||
(do
|
|
||||||
((first dispatchers) event)
|
|
||||||
(recur (next dispatchers)))
|
|
||||||
(do
|
|
||||||
(ref-set evq queuenew)
|
(ref-set evq queuenew)
|
||||||
true))))
|
true)
|
||||||
false))))
|
false))))
|
||||||
|
|
||||||
(defn handle-events [evq & dispatchers]
|
(defn handle-events [evq & dispatchers]
|
||||||
|
|
Loading…
Reference in a new issue