summaryrefslogtreecommitdiff
path: root/H12.hs
blob: 9b1b50e8257eba40e42a35ff823a621f5d1104bf (plain)
1
2
3
4
5
6
7
8
data ListItem a = Single a | Multiple a Int
    deriving (Show)

decodeModified :: [ListItem a] -> [a]
decodeModified = concatMap decodeHelper
    where
        decodeHelper (Single a) = [a]
        decodeHelper (Multiple a b) = replicate b a