Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
main :: [sys_message]
|
||||
main = [ Stdout (s ++ ": " ++ show (fromroman s) ++ "\n")
|
||||
| s <- ["MCMXC", "MDCLXVI", "MMVII", "MMXXIII"]
|
||||
]
|
||||
|
||||
fromroman :: [char]->num
|
||||
fromroman = f
|
||||
where f [] = 0
|
||||
f [x] = r x
|
||||
f (x:y:xs) = f (y:xs) - r x, if r x < r y
|
||||
= f (y:xs) + r x, otherwise
|
||||
r 'M' = 1000
|
||||
r 'D' = 500
|
||||
r 'C' = 100
|
||||
r 'L' = 50
|
||||
r 'X' = 10
|
||||
r 'V' = 5
|
||||
r 'I' = 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue