From cbf0cf6f61bbe3cd4a80b48ca3fa3135106e371e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 1 Mar 2022 02:55:27 +0100 Subject: Remove with-stream macro. It was an extra (rather complicated) macro to support, which had 2 unresolved TODO:s, and made the resulting code hard to read since it wasn't immediately apparent which procedures where replaced by their stream counterparts. The only using code was rewritten using a threading macro, which is way more readable. --- module/datetime.scm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'module/datetime.scm') diff --git a/module/datetime.scm b/module/datetime.scm index 9657a803..d5ef03b1 100644 --- a/module/datetime.scm +++ b/module/datetime.scm @@ -10,12 +10,10 @@ :use-module (srfi srfi-9 gnu) :use-module ((hnh util) - :select (vector-last define*-public set! -> swap case* set + :select (vector-last define*-public set! -> ->> swap case* set span-upto let* set->)) :use-module (srfi srfi-41) - :use-module ((srfi srfi-41 util) - :select (with-streams)) :use-module (ice-9 i18n) :use-module (ice-9 format) :use-module (ice-9 regex) @@ -538,12 +536,12 @@ ;; The amount of days in the given interval, both end pointts inclusive (define-public (days-in-interval start-date end-date) (let ((diff (date-difference (date+ end-date (date day: 1)) start-date))) - (with-streams - (fold + (day diff) - (map days-in-month - (take (+ (month diff) - (* 12 (year diff))) - (month-stream start-date))))))) + (->> (month-stream start-date) + (stream-take (+ (month diff) + (* 12 (year diff)))) + (stream-map days-in-month) + (stream-fold + (day diff))))) + ;; Day from start of the year, so 1 feb would be day 32. ;; Also known as Julian day. -- cgit v1.2.3