Sha256: 2f68c1ec458dbe6d5c605a217bd9b667e7123667429b361efcf2cbabddc81492
Contents?: true
Size: 524 Bytes
Versions: 396
Compression:
Stored size: 524 Bytes
Contents
module Roman (numerals) where numerals :: Int -> Maybe String numerals = Just . go numeralMap where go pairs@((value, digits):pairs') n | n >= value = digits ++ go pairs (n - value) | otherwise = go pairs' n go [] _ = "" numeralMap = [ (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") ]
Version data entries
396 entries across 396 versions & 1 rubygems