Last active
November 10, 2015 11:37
-
-
Save embix/7c119e3169314dbd5f61 to your computer and use it in GitHub Desktop.
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
type integerString = {i:int; s:string} | |
let FizzThrough //: integerString -> integerString = | |
input = | |
if(input.i%3=0) | |
then {i=input.i;s="Fizz"} | |
else {i=input.i;s=input.s} | |
let BuzzThrough input = | |
if(input.i%5=0) | |
then {i=input.i;s=input.s+"Buzz"} | |
else {i=input.i;s=input.s} | |
let BreakThrough input = | |
if(input.s.Length > 0) | |
then {i=input.i;s=input.s+"\n"} | |
else {i=input.i;s=input.s} | |
let HasLength input = input.s.Length>0 | |
let Print input = printf "%s" input.s | |
let asIntegerString i = {i=i; s=""} | |
[1..100] | |
|> List.map asIntegerString | |
|> List.map FizzThrough | |
|> List.map BuzzThrough | |
|> List.filter HasLength | |
|> List.map Print |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment