Created
November 10, 2014 08:09
-
-
Save kornysietsma/e1bab9697ea498a2ca58 to your computer and use it in GitHub Desktop.
basic core.async loop with tick, killer channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn irc-loop | |
"core.async based main loop" [config] | |
(let [killer (chan)] | |
(go-loop [data config] | |
(when data | |
(println "running") | |
(alt! | |
killer ([reason] (println "killed because:" reason)) | |
(timeout 1000) (do (println "tick!") | |
(recur data))))) | |
killer)) | |
(async/put! l "die") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment