Hi all,
i need a little help for haskell.
i try to make a program which makes the romans numbers in a good form, so for example if u put in [I,I,I,I] it change it to [I,V] but something always wrong with the patterns :( what did i wrong?
data RomanNumeral = I | V | X | L | C | D | M
deriving (Show, Eq, Ord, Data, Typeable)
type RomanNumber = [RomanNumeral]
compact :: [RomanNumeral] -> [RomanNumeral]
compact [] = []
compact (x:y:a:s:d:xs)
| (x:y:a:s:d) == [D,C,C,C,C] = [C,M] ++ compact xs
| (x:y:a:s) == [C,C,C,C] = [C,D] ++ compact (d:xs)
| (x:y:a:s:d) == [L,X,X,X,X] = [X,C] ++ compact xs
| (x:y:a:s) == [X,X,X,X] = [X,L] ++ compact (d:xs)
| (x:y:a:s:d) == [V,I,I,I,I] = [I,X] ++ compact xs
| (x:y:a:s) == [I,I,I,I] = [I,V] ++ compact (d:xs)
| otherwise = [x] ++ compact (y:a:s:d:xs)
if u know what did i wrong pls help asap
thx
W