One way of doing this would be to create a function that reads from the channel, buffers the values and puts to a new channel. I'm not sure how idiomatic this is though.
For example, the function below will put!
a vector into the output channel whenever the required n
items have been read from the input channel, skipping step
items after every output.
(defn stepped-partition [in n step]
(let [out (chan)]
(go-loop [buffer []]
(when-let [v (<! in)]
(let [new-buffer (conj buffer v)]
(if (= (count new-buffer) n)
(do
(put! out new-buffer)
(recur (subvec new-buffer step)))
(recur new-buffer)))))
out))
(def original (chan))
(def partitioned (stepped-partition a 3 2))
(go-loop []
(when-let [v (<! partitioned)]
(println v)
(recur)))
(async/onto-chan original [1 2 3 4 5 6 7 8 9])
;=> [1 2 3]
;=> [3 4 5]
;=> [5 6 7]
;=> [7 8 9]