Skip to content

Instantly share code, notes, and snippets.

@leobm
Forked from gerritjvv/gist:6239976
Created August 15, 2013 13:22
Show Gist options
  • Select an option

  • Save leobm/6240774 to your computer and use it in GitHub Desktop.

Select an option

Save leobm/6240774 to your computer and use it in GitHub Desktop.
;Print "Hi" every 2 seconds:
(defn t []
(go (loop [] (<! (timeout 2000)) (prn "hi") (recur))))
;or as a macro
(defmacro fixdelay [ ms & body]
`(go (loop [] (<! (timeout ~ms)) ~@body (recur))))
;now we can do
(fixdelay 2000 (prn "hi"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment