clojurewerkz / meltdown

Clojure interface to Reactor, an event-driven programming and stream processing toolkit for the JVM
210 stars 13 forks source link

Corrected typo in ### `reduce*` operation example #2

Closed maacl closed 11 years ago

michaelklishin commented 11 years ago

I'd prefer the entire example to be switched to let.

maacl commented 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 .

ifesdjeen commented 11 years ago

It will, you're right

michaelklishin commented 11 years ago

@maacl sounds like a good idea (but also no longer a few minutes of work). Feel free ;)

maacl commented 11 years ago

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))
ifesdjeen commented 11 years ago
(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))
ifesdjeen commented 11 years ago

Yup, that seems right (sorry example somehow didn't get updated in right). I agree that def is a bad pattern here :/

michaelklishin commented 11 years ago

Seems to be superseded by #3 (and no longer merges cleanly).