Skip to content

Commit

Permalink
@shritesh's solution for Idris School
Browse files Browse the repository at this point in the history
  • Loading branch information
shritesh committed Feb 27, 2018
1 parent 1a1a356 commit 97277bf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions shritesh+idris/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ibc
16 changes: 16 additions & 0 deletions shritesh+idris/FizzBuzz.idr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
fizz_buzz : Nat -> List String
fizz_buzz num =
map fb [1..num]
where
fb : Nat -> String
fb n = if mod n 15 == 0 then
"FizzBuzz"
else if mod n 3 == 0 then
"Fizz"
else if mod n 5 == 0 then
"Buzz"
else
show n

main : IO ()
main = repl "\n> " (\num => unwords (fizz_buzz (cast num)))

0 comments on commit 97277bf

Please sign in to comment.