Skip to content

Instantly share code, notes, and snippets.

@tomjack
Created June 18, 2012 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjack/e3c23b2ba35439c604c0 to your computer and use it in GitHub Desktop.
Save tomjack/e3c23b2ba35439c604c0 to your computer and use it in GitHub Desktop.
(after-loop t/timeout 1000 [i 0 j 0]
(println i j)
(when-not (>= i 5)
(let [j* (mod (inc j) 5)
i* (if (zero? j*) (inc i) i)]
(recur-after (* i 1000) i* j*))))
;; output:
00 ; t=1000
0 1
0 2
0 3
0 4
1 0 ; t = 2000
11 ; t = 3000
1 2
1 3
1 4 ; t = 6000
2 0 ; t = 8000
2 1
22
2 3
2 4
3 0
3 1
3 2
33
3 4
4 0
4 1
4 2
4 3
44
5 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment