! c1 "" /> ! c1 "" /> ! c1 ""/>

What transformation is go macro doing to the user’s code?

153 views Asked by At

How go macro transforms the code

(let [c1 (chan)
      c2 (chan)]
  (go (while true
        (let [[v ch] (alts! [c1 c2])]
          (println "Read" v "from" ch))))
  (go (>! c1 "hi"))
  (go (>! c2 "there")))
1

There are 1 answers

1
rmcv On BEST ANSWER

It is a state machine at the back. You can read more in The State Machines of core.async