Skip to content

Please add temporal-functions #936

@cbaggers

Description

@cbaggers

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions