-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Labels
Description
temporal-functions contains macros to make temporal state-machines
tlambda is a lambda with an internal concept of time
(tlambda () (before (seconds 10) (print "hi")))
Gives a function that will work for the next 10 seconds. After that with will return nil and release an 'expired' signal.
(expiredp *) ;; will return true if function has expired
Can be fairly complicated and will expand into a fast state-machine, by only using the signal mechanism if all stages have expired.
(tlambda ()
(then
(before (seconds 3)
(print "hi"))
(before (seconds 3)
(print "still here"))
(before (seconds 3)
(print "Bored now"))))
Also has brevity macros
(before (millseconds 1300)
(print "ping!"))
;; expands to
(tlambda ()
(before (millseconds 1300)
(print "ping!")))
git@github.com:cbaggers/temporal-functions.git
Thanks!