Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ikitommi committed Nov 26, 2016
1 parent 90c87d6 commit a986c44
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions dev-src/example/io2.clj
Expand Up @@ -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))
Expand Down

0 comments on commit a986c44

Please sign in to comment.