Closed maacl closed 11 years ago
Wouldn't it make sense to rewrite all the stream processing examples in that fashion then?
On Sun, Sep 22, 2013 at 8:49 PM, Michael Klishin notifications@github.comwrote:
I'd prefer the entire example to be switched to let.
— Reply to this email directly or view it on GitHubhttps://github.com/clojurewerkz/meltdown/pull/2#issuecomment-24887871 .
It will, you're right
@maacl sounds like a good idea (but also no longer a few minutes of work). Feel free ;)
Sure. Something like this(just to be sure before I do them all :-))
(let [channel (create)
incremented-values (map* inc channel)
decremented-values (map* dec channel)]
(consume incremented-values (fn [i] (println "Incremented value: "
i)))
(consume decremented-values (fn [i] (println "Decremented value: "
i)))
(accept channel 1)
(accept channel 2)
(accept channel 3))
(let [channel (create)
incremented-values (map* inc channel)
decremented-values (map* dec channel)]
(consume incremented-values (fn [i] (println "Incremented value: "
i)))
(consume decremented-values (fn [i] (println "Decremented value: "
i)))
(accept channel 1)
(accept channel 2)
(accept channel 3))
Yup, that seems right (sorry example somehow didn't get updated in right).
I agree that def
is a bad pattern here :/
Seems to be superseded by #3 (and no longer merges cleanly).
I'd prefer the entire example to be switched to
let
.