Skip to content

Instantly share code, notes, and snippets.

@pbalduino
Created February 2, 2015 23:30
Show Gist options
  • Select an option

  • Save pbalduino/bc5bfbd990d68b57b06a to your computer and use it in GitHub Desktop.

Select an option

Save pbalduino/bc5bfbd990d68b57b06a to your computer and use it in GitHub Desktop.
(defn random-number [_]
(rand-int 22))
(defn a-validate [valor]
(> valor 10))
(defn a-errorhandler [ag ex]
(println "Error: " (.getMessage ex)))
(defn a-watcher [ref chave antigo novo]
(println "Watching:" ref chave antigo novo))
(def a (agent 11 :validator a-validate :error-handler a-errorhandler :error-mode :fail))
(add-watch a :watcher-1 a-watcher)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment