leap-year-or.scm - The function leap year programmed without a conditional. | Lecture 3 - slide 12 : 42 Program 1 |
(define (leap-year? y) (or (= (modulo y 400) 0) (and (= (modulo y 4) 0) (not (= (modulo y 100) 0))))) (define (original-leap-year? y) (cond ((= (modulo y 400) 0) #t) ((= (modulo y 100) 0) #f) ((= (modulo y 4) 0) #t) (else #f)))