| how-many-hours-minutes-seconds-with-let.scm - An example of an error in let. | Lecture 1 - slide 37 : 49 Program 1 |
(define seconds-in-a-day (* 24 60 60))
(define seconds-in-an-hour (* 60 60))
(define (how-many-days-hours-minutes-seconds n)
(let ((days (quotient n seconds-in-a-day))
(n-rest-1 (modulo n seconds-in-a-day))
(hours (quotient n-rest-1 seconds-in-an-hour))
(n-rest-2 (modulo n-rest-1 seconds-in-an-hour))
(minutes (quotient n-rest-2 60))
(seconds (modulo n-rest-2 60))
)
(list days hours minutes seconds)))