Dear list, I'm playing around with core.async and I don't understand the following.
1) I make a "source" channel that emits a random number every second. (def continue (atom true)) (def source (let [out (as/chan)] (as/go-loop [] (when @continue (as/put! out (rand-int 10)) (as/<! (as/timeout 1000)) (recur))) out)) 2) I make a "sink" channel that simply discards whatever it gets: (def sink (let [in (as/chan)] (as/go-loop [] (let [v (as/<! in)] (when-not (nil? v) (recur)))) in)) 3) Now I pipe the source channel to the sink channel after mapping a print function over both of them: (as/pipe (as/map< (fn [x] (print "<") x) source) (as/map> (fn [x] (print ">") x) sink)) I expected to see a sequence of the form "<><><>...". However, only one or very few ">" get printed, so I get a sequence "<>>>...". Why? Furthermore, is what I am doing "idiomatic" or am I approaching things in the wrong way? All feedback appreciated! -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.