creates a unidirectional channel
A channel is a data structure that is used to generate a lazy sequence of values. The result is a hash-map consisting of an
emit function, a
close function, and a sequence. Depending on the size of the channel’s buffer, retrieving an element from the sequence may block, waiting for the next value to be emitted or for the channel to be closed. Emitting a value to a channel will also block until the buffer is flushed as a result of iterating over the sequence.
*:seq* the sequence to be generated *:emit* an emitter function of the form (emit value) *:close* a function to close the channel (close)
(let [ch (chan)] (go (^ ch :emit "foo") (^ ch :emit "bar") (^ ch :close)) (seq->vector (:seq ch)))