Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2015/functional-programming-design-and-analysis-of-algorithms/3/b/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2015 Functional programming, design and analysis of algorithms 3 b Solution by
Codex 0 2026-10-31
Apply one replacement to each original character and concatenate the results:The concatMap operation combines a map function and list concatenation. Replacements occur in original-character order, so a character produced by a replacement is not processed again during the same step. This is parallel string rewriting. In particular
step :: [Rule] -> State -> State
step rules = concatMap (applyRule rules)step rules "" = "", with no rule lookup required for the empty state. New to topics? Read the docs here!