Skip to content

Instantly share code, notes, and snippets.

@lepoetemaudit
Created August 25, 2015 23:13
Show Gist options
  • Save lepoetemaudit/88c2541e7cdf7745a147 to your computer and use it in GitHub Desktop.
Save lepoetemaudit/88c2541e7cdf7745a147 to your computer and use it in GitHub Desktop.
The Toki Pona number converter implementation ported from F# to Ocaml
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
in
if num > 0 then addNum num ""
else "ala";;
print_string (numberToTokiPona 19);;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment