summaryrefslogtreecommitdiff
path: root/H12.hs
diff options
context:
space:
mode:
Diffstat (limited to 'H12.hs')
-rw-r--r--H12.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/H12.hs b/H12.hs
new file mode 100644
index 0000000..9b1b50e
--- /dev/null
+++ b/H12.hs
@@ -0,0 +1,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