Skip to content

Instantly share code, notes, and snippets.

@fumieval
Created August 9, 2012 01:45
Show Gist options
  • Select an option

  • Save fumieval/3300248 to your computer and use it in GitHub Desktop.

Select an option

Save fumieval/3300248 to your computer and use it in GitHub Desktop.
showInteger n str = divmod10 n \d r -> (ifnonzero d (showInteger d) id) ((:) ((+) 48 r) str);
divmod10 n = n (\f a b -> ifgt 9 b (f a (succ b)) (f (succ a) 0) ) (:) 0 0;
fizzbuzz n a b = ifgt n 100 endofoutput
((\s p q a' b' -> if (and p q)
((++) "FizzBuzz\n" (s 0 0))
(if p ((++) "Fizz\n" (s 0 b'))
(if q ((++) "Buzz\n" (s a' 0))
(showInteger n (cons '\n' (s a' b'))))))
(fizzbuzz (succ n)) ((==) 2 a) ((==) 4 b) (succ a) (succ b));
main input = fizzbuzz 1 0 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment