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