To-chan onto-change deprecated, then what?

I saw them on API docs and wanted to try the feature. But I was told these API have been deprecated,

image

Are there any replacements?

Also I found onto-chan was used in combination of transducers, according to https://eli.thegreenplace.net/2017/reducers-transducers-and-coreasync-in-clojure/

(defn square [x] (* x x))

(def xform
  (comp
    (filter even?)
    (filter #(< % 10))
    (map square)
    (map inc)))

(def c (async/chan 1 xform))

(async/go
  (async/onto-chan c [5 6 8 12 15]))
(loop [n (async/<!! c)]
  (when n
    (println n)
    (recur (async/<!! c))))

If onto-chan has been deprecated, then how do I use transdusers with core.async ?

Use onto-chan!. Same behaviour.

This change is driven by implementation on clojure side where onto-chan!! is added so onto-chan is renamed to onto-chan!.

1 Like