Skip to content

Instantly share code, notes, and snippets.

@alexispurslane
Last active August 29, 2015 14:01
Show Gist options
  • Save alexispurslane/c97935d73c3f8f6928cd to your computer and use it in GitHub Desktop.
Save alexispurslane/c97935d73c3f8f6928cd to your computer and use it in GitHub Desktop.
A setTimeout type function for Racket. It uses seconds, has a function to call while waiting for the callback.
(define (wait time callback [t (current-seconds)] [while-wait (lambda () null)])
(cond
[(<= (+ time t) (current-seconds)) (callback)]
[else
(while-wait)
(wait time callback t)]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment