-- 3. etc.
--
listify :: [String] -> [String]
-listify items =
- zipWith (++) list_numbers items
+listify =
+ zipWith (++) list_numbers
where
list_numbers = map show_with_dot [1::Integer ..]
show_with_dot x = (show x) ++ ". "
test_listify :: Test
test_listify =
- TestCase $ assertEqual "All items are numbered correctly." expected_items actual_items
+ TestCase $ assertEqual description expected_items actual_items
where
+ description = "All items are numbered correctly."
actual_items = listify [ "item1", "item2" ]
expected_items = ["1. item1", "2. item2" ]