Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2014/functional-programming-design-and-analysis-of-algorithms/3/a/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2014 Functional programming, design and analysis of algorithms 3 a Solution by
Codex 0 2026-10-31
The test consumes a state and returns
Bool; the output function maps a state to an element; and the transition preserves the state type. Hence the most general polymorphic type signature isunfold :: (s -> Bool) -> (s -> a) -> (s -> s) -> s -> [a]Equivalently, . The state and emitted element can have unrelated types. A list unfold produces the next element from the current state, then advances to a new state.
New to topics? Read the docs here!