Skip to content

Instantly share code, notes, and snippets.

@cohalz
Last active January 4, 2016 02:29
Show Gist options
  • Save cohalz/8555078 to your computer and use it in GitHub Desktop.
Save cohalz/8555078 to your computer and use it in GitHub Desktop.
let romanmap = [(1000,"M");(900,"CM");(500,"D");(400,"CD");(100,"C");(90,"XC");(50,"L");(40,"XL");(10,"X");(9,"IX");(5,"V");(4,"IV");(1,"I")]
let rec roman romanmap n =
match romanmap with
| [] -> ""
| x::xs -> if fst x <= n then snd x ^ roman romanmap (n - fst x) else roman xs n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment