Created
August 8, 2012 19:40
-
-
Save mattmoss/3297977 to your computer and use it in GitHub Desktop.
Why does x end with value 1 rather than 0?
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 test-agent-restart [] | |
(let [x (agent 0 :error-handler (fn [a ex] (println ex) (restart-agent a 0)))] | |
(println @x) | |
(send x inc) | |
(await x) | |
(println @x) | |
(send x (fn [_] (throw (Exception. "whatever")))) | |
(await x) | |
(println @x))) |
Oops, replace # in previous comment with "#Exception java.lang.Exception: whatever"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected output:
0
1
0
Actual output:
0
1
1