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

@ -194,17 +194,48 @@ Returns a new valid month that comes ```n``` months after ```m```. If
This module implements simple calendar period handling with month
granularity.
sort-period-markers
(period-markers->periods l)
period-markers->periods
* ```l``` - list of sorted (list tag month)
periods-duration
Converts a list of period markers ```l``` into actual periods where
each period is represented by ```(list start-month end-month)```.
month-in-periods?
The ```end-month``` may be ```#f``` in which case it is an open-ended
period which has not ended yet.
periods->string
(periods-duration l)
periods-match
* ```l``` - list of periods
Returns the total duration in months of the periods given in the list
```l```. Each period is represented as ```(list start-month
end-month)```.
(month-in-periods? ps [m (*current-month*)])
* ```ps``` - a list of periods
* ```m``` - a valid month - defaults to ```(*current-month*)```
Returns ```#t``` if given month ```m``` lies within any of the periods
given in the list of periods ```ps```.
(periods->string ps)
* ```ps``` - a list of periods
Returns a string representing all the periods given in the list of
periods ```ps```. The periods are represented as
````"YYYY-MM..YYYY-MM"``` and an open end is substituded with
```"____-__"```.
(periods-match ps [m (*current-month*)])
* ```ps``` - a list of periods
Returns the period from the list of periods ```ps``` the given month
```m``` falls into. If no period matches, returns ```#f```.
### Primes