Last active
May 6, 2016 18:45
-
-
Save hlship/7999076cfb262e29fb2fbaab3aaf7e0b to your computer and use it in GitHub Desktop.
CSP using atom for state
This file contains hidden or 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
(let [n (atom 0)] | |
(go-loop [] | |
(when-let [x (<! ch)] | |
(>! next-ch x) | |
(swap! n inc) | |
(recur)) | |
@n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment