Skip to content

Commit 068de52

Browse files
authored
Merge pull request #1 from gknauth/develop
Develop
2 parents 23e07f6 + be35fde commit 068de52

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

LICENSE.txt

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ format-ymd
22
Copyright (c) 2017 gknauth (Geoffrey S. Knauth)
33

44
This package is distributed under the GNU Lesser General Public
5-
License (LGPL). This means that you can link format-ymd into proprietary
6-
applications, provided you follow the rules stated in the LGPL. You
7-
can also modify this package; if you distribute a modified version,
8-
you must distribute it under the terms of the LGPL, which in
5+
License (LGPL). This means that you can link format-numbers into
6+
proprietary applications, provided you follow the rules stated in the
7+
LGPL. You can also modify this package; if you distribute a modified
8+
version, you must distribute it under the terms of the LGPL, which in
99
particular means that you must release the source code for the
10-
modified software. See http://www.gnu.org/copyleft/lesser.html
11-
for more information. For other licenses and consulting, please contact the author.
10+
modified software. See https://www.gnu.org/licenses/lgpl-3.0.txt for
11+
more information. For other licenses and consulting, please contact
12+
the author.

main.rkt

+13
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,24 @@
139139
(define (ymd8-d1-within-days-following-d0? d0 num-days d1)
140140
(<= (ymd8-days-since d0 d1) num-days))
141141

142+
(define (every-ymd8-from-through start end)
143+
(define (helper acc a b)
144+
(cond [(= a b) (cons a acc)]
145+
[else (helper (cons a acc) (ymd8-plusdays->ymd8 a 1) b)]))
146+
(cond [(>= end start) (reverse (helper null start end))]
147+
[else null]))
148+
142149
(module+ test
143150
;; Tests to be run with raco test
144151
(require rackunit)
145152
(check-equal? (ymd8->ymd10 20170922) "2017-09-22")
146153
(check-equal? (ymd8-plusdays->ymd8 20180401 60) 20180531)
154+
(check-equal? (every-ymd8-from-through 20191127 20191204)
155+
(list 20191127 20191128 20191129 20191130
156+
20191201 20191202 20191203 20191204))
157+
(check-equal? (every-ymd8-from-through 20191127 20191127)
158+
(list 20191127))
159+
(check-equal? (every-ymd8-from-through 20191127 20191120) null)
147160
)
148161

149162
(module+ main

0 commit comments

Comments
 (0)