Re: core.async: Deprecated - this function will be removed. Use transducer instead
I'm unclear on one thing: what's the purpose of core.async/pipe? In your blog article, you write: (- source (pipe (chan)) payload-decoder payload-json-decoder) (pipe source destination) just copies elements from source to destination. How is that any different than just using source here directly?: (- source payload-decoder payload-json-decoder) What have I missed? // Ben On Thu, Feb 19, 2015 at 3:06 AM, Malcolm Sparks malc...@juxt.pro wrote: I have recently written a blog article which explains how to use transducers with core.async. You can find it here: http://malcolmsparks.com/posts/transducers.html On Wednesday, 18 February 2015 21:48:05 UTC, bsmith.occs wrote: I'm probably just especially dense today, but perhaps someone can give me a poke in the right direction. I'm trying to wrap my head around transducers. (1) For debugging purposes I'd like to be able to consume the values on a channel and put them in a collection to be printed. I'm doing this at the REPL: (async/!! (async/into [] channel)) This seems needlessly clunky. Is this really the best way to accomplish this? (2) async/map is deprecated, what's the alternative, exactly? (let [ch (async/to-chan [1 2 3])] (async/map inc ch)) AFAICT this would produce a channel, which when consumed would yield the values 2 3 4, correct? Now I suppose if I didn't already have the channel ch, I could create one with an associated transformation function, and then stuff the values 1 2 3 into it somehow, right? (let [ch (async/chan nil (map inc))] (async/onto-chan ch [1 2 3]) ch) ;; returns a channel yielding items 2, 3, 4 But, I'm not clear at all how I can apply the operation (inc) to the all values yielded by a channel I already have in my hand. Any help would be appreciated. I feel like I'm missing some critical bit of insight and that async and transducers might just fall into place for me if I could only find out what that bit is. // Ben -- 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/d/optout. -- 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/d/optout.
Re: core.async: Deprecated - this function will be removed. Use transducer instead
You're right - thanks for that! I've updated the blog article to remove it. On 19 February 2015 at 17:37, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: I'm unclear on one thing: what's the purpose of core.async/pipe? In your blog article, you write: (- source (pipe (chan)) payload-decoder payload-json-decoder) (pipe source destination) just copies elements from source to destination. How is that any different than just using source here directly?: (- source payload-decoder payload-json-decoder) What have I missed? // Ben On Thu, Feb 19, 2015 at 3:06 AM, Malcolm Sparks malc...@juxt.pro wrote: I have recently written a blog article which explains how to use transducers with core.async. You can find it here: http://malcolmsparks.com/posts/transducers.html On Wednesday, 18 February 2015 21:48:05 UTC, bsmith.occs wrote: I'm probably just especially dense today, but perhaps someone can give me a poke in the right direction. I'm trying to wrap my head around transducers. (1) For debugging purposes I'd like to be able to consume the values on a channel and put them in a collection to be printed. I'm doing this at the REPL: (async/!! (async/into [] channel)) This seems needlessly clunky. Is this really the best way to accomplish this? (2) async/map is deprecated, what's the alternative, exactly? (let [ch (async/to-chan [1 2 3])] (async/map inc ch)) AFAICT this would produce a channel, which when consumed would yield the values 2 3 4, correct? Now I suppose if I didn't already have the channel ch, I could create one with an associated transformation function, and then stuff the values 1 2 3 into it somehow, right? (let [ch (async/chan nil (map inc))] (async/onto-chan ch [1 2 3]) ch) ;; returns a channel yielding items 2, 3, 4 But, I'm not clear at all how I can apply the operation (inc) to the all values yielded by a channel I already have in my hand. Any help would be appreciated. I feel like I'm missing some critical bit of insight and that async and transducers might just fall into place for me if I could only find out what that bit is. // Ben -- 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/d/optout. -- 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 a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/z1B-42npgaI/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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/d/optout.
core.async: Deprecated - this function will be removed. Use transducer instead
I'm probably just especially dense today, but perhaps someone can give me a poke in the right direction. I'm trying to wrap my head around transducers. (1) For debugging purposes I'd like to be able to consume the values on a channel and put them in a collection to be printed. I'm doing this at the REPL: (async/!! (async/into [] channel)) This seems needlessly clunky. Is this really the best way to accomplish this? (2) async/map is deprecated, what's the alternative, exactly? (let [ch (async/to-chan [1 2 3])] (async/map inc ch)) AFAICT this would produce a channel, which when consumed would yield the values 2 3 4, correct? Now I suppose if I didn't already have the channel ch, I could create one with an associated transformation function, and then stuff the values 1 2 3 into it somehow, right? (let [ch (async/chan nil (map inc))] (async/onto-chan ch [1 2 3]) ch) ;; returns a channel yielding items 2, 3, 4 But, I'm not clear at all how I can apply the operation (inc) to the all values yielded by a channel I already have in my hand. Any help would be appreciated. I feel like I'm missing some critical bit of insight and that async and transducers might just fall into place for me if I could only find out what that bit is. // Ben -- 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/d/optout.
Re: core.async: Deprecated - this function will be removed. Use transducer instead
(let [out (async/chan 0 (map inc))] (async/pipe in out) out) Earlier in your email you mention printing, however. If you have I/O to perform (like printing), I’m told that you don’t want to do it in a transducer. You can use pipeline-async for this instead: (defn f [v ch] (async/go (println v) (async/! ch v))) (let [out (async/chan)] (async/pipeline-async 1 out f in) out) (If I’m doing this wrong, someone please steer me in the right direction.) e On Wed, Feb 18, 2015 at 4:47 PM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: I'm probably just especially dense today, but perhaps someone can give me a poke in the right direction. I'm trying to wrap my head around transducers. (1) For debugging purposes I'd like to be able to consume the values on a channel and put them in a collection to be printed. I'm doing this at the REPL: (async/!! (async/into [] channel)) This seems needlessly clunky. Is this really the best way to accomplish this? (2) async/map is deprecated, what's the alternative, exactly? (let [ch (async/to-chan [1 2 3])] (async/map inc ch)) AFAICT this would produce a channel, which when consumed would yield the values 2 3 4, correct? Now I suppose if I didn't already have the channel ch, I could create one with an associated transformation function, and then stuff the values 1 2 3 into it somehow, right? (let [ch (async/chan nil (map inc))] (async/onto-chan ch [1 2 3]) ch) ;; returns a channel yielding items 2, 3, 4 But, I'm not clear at all how I can apply the operation (inc) to the all values yielded by a channel I already have in my hand. Any help would be appreciated. I feel like I'm missing some critical bit of insight and that async and transducers might just fall into place for me if I could only find out what that bit is. // Ben -- 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/d/optout. -- 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/d/optout.
Re: core.async: Deprecated - this function will be removed. Use transducer instead
Thanks Malcolm, you're blog post was a great help to me. On Thu, Feb 19, 2015 at 3:06 AM, Malcolm Sparks malc...@juxt.pro wrote: I have recently written a blog article which explains how to use transducers with core.async. You can find it here: http://malcolmsparks.com/posts/transducers.html On Wednesday, 18 February 2015 21:48:05 UTC, bsmith.occs wrote: I'm probably just especially dense today, but perhaps someone can give me a poke in the right direction. I'm trying to wrap my head around transducers. (1) For debugging purposes I'd like to be able to consume the values on a channel and put them in a collection to be printed. I'm doing this at the REPL: (async/!! (async/into [] channel)) This seems needlessly clunky. Is this really the best way to accomplish this? (2) async/map is deprecated, what's the alternative, exactly? (let [ch (async/to-chan [1 2 3])] (async/map inc ch)) AFAICT this would produce a channel, which when consumed would yield the values 2 3 4, correct? Now I suppose if I didn't already have the channel ch, I could create one with an associated transformation function, and then stuff the values 1 2 3 into it somehow, right? (let [ch (async/chan nil (map inc))] (async/onto-chan ch [1 2 3]) ch) ;; returns a channel yielding items 2, 3, 4 But, I'm not clear at all how I can apply the operation (inc) to the all values yielded by a channel I already have in my hand. Any help would be appreciated. I feel like I'm missing some critical bit of insight and that async and transducers might just fall into place for me if I could only find out what that bit is. // Ben -- 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/d/optout. -- 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/d/optout.
Re: core.async: Deprecated - this function will be removed. Use transducer instead
I have recently written a blog article which explains how to use transducers with core.async. You can find it here: http://malcolmsparks.com/posts/transducers.html On Wednesday, 18 February 2015 21:48:05 UTC, bsmith.occs wrote: I'm probably just especially dense today, but perhaps someone can give me a poke in the right direction. I'm trying to wrap my head around transducers. (1) For debugging purposes I'd like to be able to consume the values on a channel and put them in a collection to be printed. I'm doing this at the REPL: (async/!! (async/into [] channel)) This seems needlessly clunky. Is this really the best way to accomplish this? (2) async/map is deprecated, what's the alternative, exactly? (let [ch (async/to-chan [1 2 3])] (async/map inc ch)) AFAICT this would produce a channel, which when consumed would yield the values 2 3 4, correct? Now I suppose if I didn't already have the channel ch, I could create one with an associated transformation function, and then stuff the values 1 2 3 into it somehow, right? (let [ch (async/chan nil (map inc))] (async/onto-chan ch [1 2 3]) ch) ;; returns a channel yielding items 2, 3, 4 But, I'm not clear at all how I can apply the operation (inc) to the all values yielded by a channel I already have in my hand. Any help would be appreciated. I feel like I'm missing some critical bit of insight and that async and transducers might just fall into place for me if I could only find out what that bit is. // Ben -- 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/d/optout.