Fork me on GitHub
#core-async
<
2018-12-22
>
Jon03:12:41

what's the difference between >! and put!? I thought they are identical before, but turned out put! is different

Jon04:12:17

(defn afile?
  "Asynchronous file predicate.
   @param {!string} pathstr
   @return {!Channel} promise-chan receiving boolean"
  [pathstr]
  (assert (string? pathstr))
  (let [c (promise-chan)
        stat-ch (alstat pathstr)]
    (take! stat-ch
      (fn [[err stats]]
        (put! c (if-not err (.isFile stats) false))))
    c))

Jon04:12:38

put! is used outside go block...

Jon04:12:57

and this is in ClojureScript, calling Node.js APIs

Jon04:12:00

not JVM Clojure

orestis18:12:40

put! doesn’t block, and can be used outside go blocks AFAIK.