Previous: Coroutines, Up: Time [Contents][Index]
(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.
Create a new, empty agenda.
Return #t
if obj is an agenda.
A parameter containing the current, dynamically scoped agenda object.
Return the time of the current agenda.
Evaluate body with current-agenda
bound to agenda.
Increment time by 1 for the current agenda and run scheduled procedures.
Remove all scheduled procedures from the current agenda.
Schedule thunk to be applied after delay ticks of the current agenda. The default delay is one tick.
Schedule thunk to be applied every interval ticks of the current agenda, forever.
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.
Abort the current coroutine prompt and schedule the continuation to be run after delay ticks of the current agenda.
Previous: Coroutines, Up: Time [Contents][Index]