I want to create a channel of clojure.core.async
from another one that just filters specific messages. Therefore I found a function called filter<.
=> (def c1 (chan))
=> (def c2 (filter< even? c1))
=> (put! c1 1)
=> (put! c1 2)
=> (<!! c2)
2
But the function and its friends are marked as deprecated:
Deprecated - this function will be removed. Use transducer instead
There are some ways to use channels with transducer like chan
with the xform
parameter. How can I build a new channel from an existing one using transducers?
pipe
. (defn from-chan [ci xf] (let [co (chan 1 xf)] (pipe ci co) co)) – Executor