core-async

Karl Xaver 2025-05-06T11:19:27.359049Z

Playing with flow, I've been running into "this process is just a transducer" and wrote something like

(f/create-flow
 {:procs {:odds {:proc      (-> identity f/lift1->step f/process)
                 :chan-opts {:in {:buf-or-n 10 :xform (filter odd?)}}}}})
After a couple of times I easified that to
(f/create-flow 
 {:procs {:odds (xf-proc :xform (filter odd?))}})
with
(defn xf-proc [& {:keys [xform buf-or-n] :or {buf-or-n 10}}]
  {:proc      (-> identity f/lift1->step f/process)
   :chan-opts {:in {:buf-or-n buf-or-n :xform xform}}})
Any reason not to do this / potential pitfalls with the general approach?

Alex Miller (Clojure team) 2025-05-06T11:39:40.086129Z

Seems fine

👍 1