From 9224412274e1e1a31a959083bb257a7d6ab2b113 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 19 Aug 2016 20:40:12 -0400 Subject: Add Sly manual. --- manuals/sly/Agendas.html | 163 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 manuals/sly/Agendas.html (limited to 'manuals/sly/Agendas.html') diff --git a/manuals/sly/Agendas.html b/manuals/sly/Agendas.html new file mode 100644 index 0000000..b30aa98 --- /dev/null +++ b/manuals/sly/Agendas.html @@ -0,0 +1,163 @@ + + + + + +Sly: Agendas + + + + + + + + + + + + + + + + + + + + +
+

+Previous: , Up: Time   [Contents][Index]

+
+
+ +

4.3.3 Agendas

+ +
+
(use-modules (sly agenda))
+
+ +

Agendas are used to schedule procedures to be called at distinct +points in time. One agenda, stored in the current-agenda +parameter, is active at any given time. A global agenda is initially +bound and is sufficient for most needs. When a separate scheduler is +required (see REPL for one such case), the parameter can be +rebound using parameterize or with-agenda form. +

+
+
Scheme Procedure: make-agenda
+

Create a new, empty agenda. +

+ +
+
Scheme Syntax: agenda? obj
+

Return #t if obj is an agenda. +

+ +
+
Scheme Variable: current-agenda
+

A parameter containing the current, dynamically scoped agenda object. +

+ +
+
Scheme Procedure: agenda-time
+

Return the time of the current agenda. +

+ +
+
Scheme Syntax: with-agenda agenda body
+

Evaluate body with current-agenda bound to agenda. +

+ +
+
Scheme Procedure: agenda-tick!
+

Increment time by 1 for the current agenda and run scheduled +procedures. +

+ +
+
Scheme Procedure: agenda-clear!
+

Remove all scheduled procedures from the current agenda. +

+ +
+
Scheme Procedure: schedule thunk [delay]
+

Schedule thunk to be applied after delay ticks of the +current agenda. The default delay is one tick. +

+ +
+
Scheme Procedure: schedule-interval thunk interval
+

Schedule thunk to be applied every interval ticks of the +current agenda, forever. +

+ +
+
Scheme Procedure: schedule-each thunk
+

Schedule thunk to be applied upon every tick of the current +agenda, forever. +

+ +

Coroutines become particularly useful for game programming when +combined with the agenda. For example, a computer controller opponent +could periodically pause its AI algorithm to give the rest of the game +world a chance to do some processing. By using the wait +procedure, algorithms that span multiple ticks of game time can be +written in a straightforward, natural way. +

+
+
Scheme Procedure: wait delay
+

Abort the current coroutine prompt and schedule the continuation to be +run after delay ticks of the current agenda. +

+
+
+

+Previous: , Up: Time   [Contents][Index]

+
+ + + + + -- cgit v1.2.3