Skip to content

Instantly share code, notes, and snippets.

@omegatakuma
Created August 9, 2012 00:34
Show Gist options
  • Save omegatakuma/3299966 to your computer and use it in GitHub Desktop.
Save omegatakuma/3299966 to your computer and use it in GitHub Desktop.
周期性を利用したFizzBuzz
(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