fix handlers-> macro
This commit is contained in:
parent
1a997cad39
commit
06bff32f79
|
@ -6,7 +6,13 @@
|
||||||
If one handler returns a modified db it will be used as parameters for subsequent handlers."
|
If one handler returns a modified db it will be used as parameters for subsequent handlers."
|
||||||
[& forms]
|
[& forms]
|
||||||
(let [db (gensym "db")
|
(let [db (gensym "db")
|
||||||
event (gensym "event")]
|
event (gensym "event")
|
||||||
|
new-db (gensym "new-db")]
|
||||||
`(fn [~db ~event]
|
`(fn [~db ~event]
|
||||||
(let [~@(interleave (repeat db) (map #(list 'or (list % db event) db) forms))]
|
(let [~@(interleave (repeat db)
|
||||||
|
(map (fn [form]
|
||||||
|
`(let [~new-db (~form ~db ~event)]
|
||||||
|
(if (map? ~new-db)
|
||||||
|
~new-db
|
||||||
|
~db))) forms))]
|
||||||
~db))))
|
~db))))
|
Loading…
Reference in New Issue