date-utilities.scm: optimize leapyear calc

This commit is contained in:
Christopher Lam 2017-12-21 19:55:38 +08:00
parent 33a7bb73db
commit 7550ccf537

View File

@ -159,11 +159,9 @@
;; is leap year?
(define (gnc:leap-year? year)
(if (= (remainder year 4) 0)
(if (= (remainder year 100) 0)
(if (= (remainder year 400) 0) #t #f)
#t)
#f))
(or (and (zero? (remainder year 4))
(not (zero? (remainder year 100))))
(zero? (remainder year 400))))
;; number of days in year
(define (gnc:days-in-year year)