core-async

James Amberger 2025-02-16T14:48:52.970669Z

is this smart, or dumb?

(defn f [val-or-chan]
  (go
    (let [val (if (satisfies? clojure.core.async.impl.protocols/ReadPort val-or-chan)
                (
Motivation is api calls where I might be supplying the value by hand, or synchronously, or from another api call.

✅ 1
Alex Miller (Clojure team) 2025-02-16T15:37:55.612639Z

In general, I think functions that take “thing or container of thing” (where container is a collection, a ref, a chan, etc) are a bad idea, and I almost always regret them.

☝️ 3