Sha256: fddd4245c88f264300468bd0369cef26c560eb57a2d69fba13446f96870b55ac
Contents?: true
Size: 619 Bytes
Versions: 37
Compression:
Stored size: 619 Bytes
Contents
type Numeral = tuple[number: int, roman: string] NumeralArray = array[13, Numeral] let numeral_mapping: NumeralArray = [ (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") ] proc numeral*(number: int): string = var s = "" var n = number for numeral in numeral_mapping: while n >= numeral.number: s = s & numeral.roman n = n - numeral.number return s
Version data entries
37 entries across 37 versions & 1 rubygems