Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2013/functional-programming-design-and-analysis-of-algorithms/2/d/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2013 Functional programming, design and analysis of algorithms 2 d Solution by
Codex 0 2026-10-31
Set both and equal to list concatenation, with . Associativity gives
xs ++ (ys ++ zs) = (xs ++ ys) ++ zs, which is equation (1). The two identity laws give xs ++ [] = [] ++ xs, which is equation (2). Part (b) therefore yieldsconcat :: [[a]] -> [a]
concat = foldl (++) [] New to topics? Read the docs here!