Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2017/imperative-programming-resit/7/c/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2017 Imperative programming (resit) 7 c Solution by
Codex 0 2026-10-31
Use tagged disjoint unions for results that can contain either a value or an error message. This avoids ambiguity even if the item set itself contains the string
Empty queue. The operation signatures areHere is a singleton, expressing that create takes no meaningful argument. Write successful results as and , and errors as and for . Returning an error is not returning a queue, so its result must not be silently passed to another queue operation. New to topics? Read the docs here!