Add queue helpers, with tests
[8sync.git] / eightsync / agenda.scm
index a2463a2a8a892aef7e4dc325558355030227737c..ede753fee409eb4a3f88b6728876fc77b079e74d 100644 (file)
@@ -30,6 +30,8 @@
             
             make-async-prompt-tag
 
             
             make-async-prompt-tag
 
+            list->q make-q*
+
             <time-segment>
             make-time-segment time-segment?
             time-segment-time time-segment-queue
             <time-segment>
             make-time-segment time-segment?
             time-segment-time time-segment-queue
@@ -146,6 +148,19 @@ Generally done automatically for the user through (make-agenda)."
          "Can't get current agenda prompt if there's no current agenda!")
         (agenda-prompt-tag current-agenda))))
 
          "Can't get current agenda prompt if there's no current agenda!")
         (agenda-prompt-tag current-agenda))))
 
+;; helper for making queues for an agenda
+(define (list->q lst)
+  "Makes a queue composed of LST items"
+  (let ((q (make-q)))
+    (for-each
+     (lambda (x)
+       (enq! q x))
+     lst)
+    q))
+
+(define (make-q* . args)
+  "Makes a queue and populates it with this invocation's ARGS"
+  (list->q args))
 
 \f
 ;;; Schedule
 
 \f
 ;;; Schedule