coroutines.glisp 269 B

123456789101112
  1. (def ch (make-chan))
  2. ; test that channels and symbol translation are working
  3. (go (send! ch 'foo))
  4. (assert (= 'foo (<! ch)))
  5. ; test that coroutines share the same global scope
  6. (def global "foo")
  7. (go (send! ch '()) (def global "bar"))
  8. (<! ch)
  9. (assert (= global "bar"))