Skip to content

Instantly share code, notes, and snippets.

@theodesp
Created August 23, 2018 12:14
Show Gist options
  • Save theodesp/cbbcf2aac934763a652bc40a0344e8e6 to your computer and use it in GitHub Desktop.
Save theodesp/cbbcf2aac934763a652bc40a0344e8e6 to your computer and use it in GitHub Desktop.
Is Leap year #scheme
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
(define (leap-year? year)
(if (and (divisible? year 4) (not (divisible? year 100)))
#t
(if (divisible? year 400)
#t
#f)))
@theodesp
Copy link
Author

theodesp commented Aug 26, 2019

I think you only need to provide the divisible? function

(define (divisible? n x)
  (zero? (remainder n x)))

and skip the imports in the beginning. I think they only work for guile scheme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment