Created
August 9, 2012 00:34
-
-
Save omegatakuma/3299966 to your computer and use it in GitHub Desktop.
周期性を利用したFizzBuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define fizzbuzz '(1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 Fizzbuzz)) | |
(define (solve n) | |
(let loop ((num 1)(lst fizzbuzz)(m 1)) | |
(cond | |
((null? lst) | |
(loop num (map (lambda(x)(if (number? x)(+ x (* 15 m)) x)) fizzbuzz) (+ m 1))) | |
((>= n num) | |
(print (car lst)) | |
(loop (+ num 1) (cdr lst) m))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment