From 6ff97f3185245a9eea3fe8726f7ceef068069997 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 15 Sep 2013 20:26:29 -0400 Subject: Add agenda-schedule-interval procedure. --- 2d/agenda.scm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/2d/agenda.scm b/2d/agenda.scm index ca23dac..6e9f61d 100644 --- a/2d/agenda.scm +++ b/2d/agenda.scm @@ -28,6 +28,7 @@ #:export (make-agenda with-agenda agenda-schedule + agenda-schedule-interval update-agenda clear-agenda)) @@ -170,9 +171,21 @@ in the list" (set-agenda-segments! agenda '())) (define* (agenda-schedule thunk #:optional (delay 1)) - "Schedules thunk in the current agenda." + "Schedules THUNK in the current agenda to run after DELAY +updates (1 by default)." (%agenda-schedule *current-agenda* thunk delay)) +(define* (agenda-schedule-interval thunk #:optional (interval 1) (delay 1)) + "Schedules THUNK in the current agenda to run after DELAY updates +and run every INTERVAL updates thereafter. Both DELAY and INTERVAL +default to 1. Simply pass THUNK and nothing else to schedule THUNK to +be run upon every update." + (%agenda-schedule *current-agenda* + (lambda () + (thunk) + (agenda-schedule-interval thunk interval interval)) + delay)) + (define (update-agenda) "Updates the current agenda." (%update-agenda *current-agenda*)) -- cgit v1.2.3