summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-10-14 21:27:47 -0400
committerDavid Thompson <dthompson2@worcester.edu>2017-10-14 21:31:54 -0400
commite659085e675c331bfbd43c85c101af21978145b4 (patch)
tree88421bc36ae6bbf796b6912d71c40d4bbeb93c8d
parent1bc69dceb044af644103aa29e5fa2249655a75a6 (diff)
scripting: Rename wait to sleep.
* chickadee/scripting.scm (wait): Rename to... (sleep): ...this.
-rw-r--r--chickadee/scripting.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/chickadee/scripting.scm b/chickadee/scripting.scm
index d4a2b81..0e29fa6 100644
--- a/chickadee/scripting.scm
+++ b/chickadee/scripting.scm
@@ -22,8 +22,9 @@
#:use-module (chickadee scripting channel)
#:use-module (chickadee scripting coroutine)
#:export (forever
- wait
- tween))
+ sleep
+ tween)
+ #:replace (sleep))
;; Export public bindings from other modules.
(eval-when (eval load compile)
@@ -40,8 +41,10 @@
"Evaluate BODY in an endless loop."
(while #t body ...))
-(define (wait duration)
+(define (sleep duration)
"Wait DURATION before resuming the current coroutine."
+ ;; Capture the current agenda before suspending the coroutine so
+ ;; that we schedule the continuation in the right place.
(let ((agenda (current-agenda)))
(yield
(lambda (cont)
@@ -66,5 +69,5 @@ END. By default, linear interpolation is used."
(proc end)
(let ((alpha (ease (/ t duration))))
(proc (interpolate start end alpha))
- (wait step)
+ (sleep step)
(loop (+ t step))))))