Skip to content

Instantly share code, notes, and snippets.

@ayato-p
Created July 28, 2016 23:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayato-p/c9a001c38c6f74957c7bb645f3bd4903 to your computer and use it in GitHub Desktop.
Save ayato-p/c9a001c38c6f74957c7bb645f3bd4903 to your computer and use it in GitHub Desktop.
(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