make-async-prompt-tag
+ list->q make-q*
+
<time-segment>
make-time-segment time-segment?
time-segment-time time-segment-queue
"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
messages)))
\f
-;; Timer tests
-;; ===========
+;;; queue helpers
+;;; =============
+
+(define test-q (list->q '(1 2 3)))
+(test-equal (deq! test-q) 1)
+(test-equal (deq! test-q) 2)
+(test-equal (deq! test-q) 3)
+(test-assert (q-empty? test-q))
+
+(define test-q (make-q* 'apple 'banana 'carrot))
+(test-equal (deq! test-q) 'apple)
+(test-equal (deq! test-q) 'banana)
+(test-equal (deq! test-q) 'carrot)
+(test-assert (q-empty? test-q))
+
+
+\f
+;;; Timer tests
+;;; ===========
(test-assert (time= '(1 . 1) '(1 . 1)))
(test-assert (not (time= '(1 . 1) '(1 . 0))))