Last active
December 14, 2015 13:18
-
-
Save cromwellryan/5092417 to your computer and use it in GitHub Desktop.
Fizzbuzz done in F# & Coffeescript
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
firsthund = [1..100] | |
isfizz = (x) -> | |
x % 3 == 0 | |
isbuzz = (x) -> | |
x % 5 == 0 | |
handle = (x) -> | |
if isfizz(x) and isbuzz(x) then 'fizzbuzz' | |
else if isfizz x then 'fizz' | |
else if isbuzz x then 'buzz' | |
else x | |
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
let firstHundred = [1..100] | |
let isbuzz x = | |
x % 5 = 0 | |
let isfizz x = | |
x % 3 = 0 | |
let handleNum x = | |
match x with | |
| (x) when isfizz x && isbuzz x -> "fizzbuzz" | |
| (x) when isfizz x -> "fizz" | |
| (x) when isbuzz x -> "buzz" | |
| _ -> x.ToString() | |
//if isfizz x then "fizz" else x.ToString() | |
List.map handleNum firstHundred | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment