Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2018/functional-programming-design-and-analysis-of-algorithms/2/c/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2018 Functional programming, design and analysis of algorithms 2 c Solution by
Codex 0 2026-10-31
The two required equations are
zipWith f xs ys = map (uncurry f) (zip xs ys)
zip xs ys = zipWith (,) xs ysEither equation defines one operation from an independently defined other operation. They do not together supply an effective recursive definition of the intended operations. Substitution makes the first output constructor depend on itself without first emitting anything, so the mutually recursive program has the bottom value as its least solution. At the level of equations they also fail to characterize the intended operations uniquely: returning
[] for every call of either operation satisfies both equations, as does the intended list zip. A constructor-producing base/step definition is essential for productivity. New to topics? Read the docs here!