Finish period documentation, cleanup period usage.

This commit is contained in:
Dominik Pantůček 2023-03-22 22:58:02 +01:00
parent 9385745cf7
commit 4196e95118
3 changed files with 41 additions and 14 deletions

View file

@ -28,7 +28,6 @@
(module
period
(
sort-period-markers
period-markers->periods
periods-duration
month-in-periods?
@ -58,7 +57,7 @@
;; Converts list of start/stop markers to list of pairs of months -
;; periods.
(define (period-markers->periods l)
(let loop ((l l)
(let loop ((l (sort-period-markers l))
(ps '())
(cb #f))
(if (null? l)
@ -129,9 +128,7 @@
(define (period->string p)
(sprintf "~A..~A"
(month->string (car p))
(if (cdr p)
(month->string (cdr p))
"****-**")))
(month->string (cdr p))))
;; Returns a string representing a list of periods.
(define (periods->string ps)
@ -139,7 +136,7 @@
(map period->string ps)
", "))
;; Finds a period the month marthes and returns it. If no period
;; Finds a period the month matches and returns it. If no period
;; matches, it returns #f.
(define (periods-match ps . ml)
(let ((m (if (null? ml) (*current-month*) (car ml))))