diff --git a/period.scm b/period.scm index 93c2b22..739ee9a 100644 --- a/period.scm +++ b/period.scm @@ -61,18 +61,15 @@ ;; Converts list of start/stop markers to list of pairs of months - ;; periods. (define (period-markers->periods l) - (print "===") (let loop ((l l) (ps '()) (cb #f)) - (print l) (if (null? l) (if cb (reverse (cons (cons cb #f) ps)) (reverse ps)) (let ((m (car l)) (rmt (if cb 'stop 'start))) - (print " m: " m) (if (eq? (car m) rmt) (if cb (loop (cdr l) @@ -151,16 +148,16 @@ (run-tests period (test-equal? sort-period-markers - (sort-period-markers '((start 2023 1) (stop 2022 10) (start 2022 3))) - '((start 2022 3) (stop 2022 10) (start 2023 1))) + (sort-period-markers '((start (2023 1)) (stop (2022 10)) (start (2022 3)))) + '((start (2022 3)) (stop (2022 10)) (start (2023 1)))) (test-equal? period-markers->periods (period-markers->periods - '((start 2022 3) (stop 2022 10) (start 2023 1) (stop 2023 4))) + '((start (2022 3)) (stop (2022 10)) (start (2023 1)) (stop (2023 4)))) '(((2022 3) . (2022 10)) ((2023 1) . (2023 4)))) (test-equal? period-markers->periods-open (period-markers->periods - '((start 2022 3) (stop 2022 10) (start 2023 1) (stop 2023 4) (start 2023 5))) + '((start (2022 3)) (stop (2022 10)) (start (2023 1)) (stop (2023 4)) (start (2023 5)))) '(((2022 3) . (2022 10)) ((2023 1) . (2023 4)) ((2023 5) . #f)))