More month comparison functions.

This commit is contained in:
Dominik Pantůček 2023-03-21 19:23:40 +01:00
parent 00e2cab0ae
commit 922b178519
2 changed files with 22 additions and 3 deletions

View file

@ -34,6 +34,9 @@
month->string
month=?
month<?
month<=?
month>=?
month>?
month-diff
month-add
month-tests!
@ -108,6 +111,19 @@
(and (= (car m) (car n))
(< (cadr m) (cadr n))))))
;; Returns true if m is less than or equal n
(define (month<=? m n)
(or (month<? m n)
(month=? m n)))
;; Returns true if m is greater than or equal to n
(define (month>=? m n)
(not (month<? m n)))
;; Returns true if m is greater than n
(define (month>? m n)
(not (month<=? m n)))
;; Returns the number of months between from f and to t. The first
;; month is included in the count, the last month is not.
(define (month-diff f t)