Permalink
Browse files

cleanup

  • Loading branch information...
ikitommi committed Nov 26, 2016
1 parent 90c87d6 commit a986c44fcec8ba6e8e4d86381b84624e560e7ded
Showing with 10 additions and 10 deletions.
  1. +10 −10 dev-src/example/io2.clj
@@ -11,17 +11,17 @@
(defrecord IOResult [io acc])

(defn run-io! [dispatcher {:keys [io]}]
(map->IOResult
(reduce
(fn [{:keys [io acc]} [action data]]
(let [io-result (k/invoke dispatcher action {:data data, :acc acc})]
(when-not (or (map? io-result) (nil? io-result))
(throw (ex-info "IO must return a map or nil" {:result io-result})))
{:io (conj io [action data io-result])
:acc (merge acc io-result)}))
(reduce
(fn [{:keys [io acc]} [action data]]
(let [io-result (k/invoke dispatcher action {:data data, :acc acc})]
(when-not (or (map? io-result) (nil? io-result))
(throw (ex-info "IO must return a map or nil" {:result io-result})))
{:io (conj io [action data io-result])
:acc (merge acc io-result)}))
(map->IOResult
{:io []
:acc {}}
io)))
:acc {}})
io))

(defn log! [fmt & args]
(apply printf (str "\u001B[35m" fmt "\u001B[0m\n") args))

0 comments on commit a986c44

Please sign in to comment.