From 922b178519b4c473f7bd445c97e18edd708c79ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Pant=C5=AF=C4=8Dek?= Date: Tue, 21 Mar 2023 19:23:40 +0100 Subject: [PATCH] More month comparison functions. --- README.md | 9 ++++++--- month.scm | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6e72075..99496ac 100644 --- a/README.md +++ b/README.md @@ -91,16 +91,19 @@ Functional Modules ### Member Base +Specific Support Modules +------------------------ + ### Month ### Period ### Primes -Support Modules ---------------- +Generic Support Modules +----------------------- -There modules are not specific to this project but had to be +These modules are not specific to this project but had to be implemented anyway to not require any external dependencies. ### ANSI diff --git a/month.scm b/month.scm index ae376ed..cdeca15 100644 --- a/month.scm +++ b/month.scm @@ -34,6 +34,9 @@ month->string 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) + (not (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)