Created
August 14, 2015 10:28
-
-
Save lepoetemaudit/59bb689b7d069e42ccba to your computer and use it in GitHub Desktop.
Tail-recursive Toki Pona number to string function
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 numberToTokiPona num = | |
let rec addNum num str = | |
if num >= 2 then addNum (num-2) (str + "twu ") | |
else if num = 1 then addNum (num-1) (str + "wan ") | |
else str | |
if num > 0 then addNum num "" | |
else "ala" | |
(numberToTokiPona 19) |> printfn "%s" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment