Skip to content

Instantly share code, notes, and snippets.

@ztellman
Forked from jasonjckn/gist:983316
Created May 20, 2011 17:30
Show Gist options
  • Save ztellman/983370 to your computer and use it in GitHub Desktop.
Save ztellman/983370 to your computer and use it in GitHub Desktop.
(defn handler [ch _] (receive-all ch print) (enqueue ch "hi"))
(defn test-harness []
(let [[a b] (channel-pair)]
(handler b nil) ;; give handler one side of the channel pair
(enqueue a 1 2 3) ;; these will be received by 'b', and the handler will print out '123'
(println (channel-seq a)))) ;; will print '["hi"]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment