The `mapcat` transducer takes a collection as its input and outputs each of its items individually. This example might be helpful:
user> (use ‘[clojure.core.async]) nil user> (def work-queue (chan 1 (mapcat identity))) #’user/work-queue user> (offer! work-queue (range 50)) true user> (<!! work-queue) 0 user> (<!! work-queue) 1 user> (offer! work-queue (range 50)) nil user> (dotimes [_ 48] (<!! work-queue)) nil user> (offer! work-queue (range 50)) true user> (<!! work-queue) 0 The work-queue channel has a fixed buffer size of 1. A collection (range 50) is put on the channel. While consumers can take items off the channel — note the individual contents of (range 50) are returned — a producer cannot put another value onto the channel until the entire initial collection is consumed. Once that channel is exhausted -- (0…49) are taken from the channel -- it’s buffer is empty and ready to accept another value. I’m not very confident I use core.async idiomatically — I probably played too much The Incredible Machine growing up — but this looks OK :) > On Jan 5, 2018, at 2:10 PM, Rob Nikander <rob.nikan...@gmail.com> wrote: > > > > On Friday, January 5, 2018 at 2:03:00 PM UTC-5, Brian J. Rubinton wrote: > > What is the buffered channel’s buffer used for? If that’s set to 1 and the > channel’s transducer is `(mapcat identity)` then the producer should be able > to continuously put chunks of work onto the channel with the puts only > completing when the previous chunk is completely consumed. > > The buffer is sort of a work queue, used to break up and distribute one > "chunk" to a pool of consumers. I was imaging the buffer would be size 50. So > the producer would grab 50 rows (one "chunk") and put them all in the > channel. Consumers would pick them out one by one. > > I'm not familiar with the transducer concept so I need to go read a bit > before I can understand your point about the channel's transducer being > `(mapcat identity)`. > > > > -- > 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 > <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 > <mailto:clojure+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <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.