I have a channel into which I am putting a number of individual values (JSON lines, incidentally).
In taking values off the channel, I wish to batch-process them as a group. Is there any notion of take n
from the channel or else a means to bundle them into a vector/sequence/list?
You can use clojure.core.async/take
to take a specific number of items off a channel. They are returned in the form of a new channel, so you still have to use <!
, <!!
, or take!
to process them individually. If you want to process them as a group, you can use clojure.core.async/into
to put them into a standard Clojure data structure.