Created
July 28, 2016 23:55
-
-
Save ayato-p/c9a001c38c6f74957c7bb645f3bd4903 to your computer and use it in GitHub Desktop.
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
(def a (agent 100 | |
:validator #(not= % 1) | |
:error-handler println)) | |
(defmulti collatz even?) | |
(defmethod collatz true | |
[x] | |
(println x) | |
(/ x 2)) | |
(defmethod collatz false | |
[x] | |
(println x) | |
(+ (* x 3) 1)) | |
(dotimes [_ 100] | |
(send a collatz)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment