Skip to content

Instantly share code, notes, and snippets.

@ryanseys
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanseys/9318095 to your computer and use it in GitHub Desktop.
Save ryanseys/9318095 to your computer and use it in GitHub Desktop.
Recursive FizzBuzz in Scheme
#lang racket
(define (fizzbuzz n limit)
(cond
((eq? (modulo n 15) 0)
(printf "~a: FizzBuzz~n" n))
((eq? (modulo n 3) 0)
(printf "~a: Fizz~n" n))
((eq? (modulo n 5) 0)
(printf "~a: Buzz~n" n)))
(if (not (eq? n limit)) (fizzbuzz (+ n 1) limit) (display "Done")))
(fizzbuzz 0 100)
@benbrittain
Copy link

... (printf "~a: Buzz~n" n)))

not

... (printf "~a: Buzz~n" n)
    )
)

@ryanseys
Copy link
Author

ryanseys commented Mar 3, 2014

Like dis?

@benbrittain
Copy link

+1

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