Curried function 2026-10-31
In functional programming, currying represents a function of several arguments as successive one-argument functions. In Haskell, arrows associate to the right:
a -> b -> c means a -> (b -> c). Supplying an argument of type a therefore returns a function of type b -> c, while a function of type (a,b) -> c expects a tuple. Uncurrying converts the first representation to the second. Functional programming Created 2026-10-13 Updated 2026-11-05
Functional programming emphasizes computation by evaluating and composing functions, often using immutable data and expression-based definitions. A pure function has no observable side effects and returns the same result for the same inputs, allowing substitution of equals for equals. Mapping a square function over a list illustrates a direct transformation without an externally updated accumulator. Higher-order functions accept or return functions, making patterns such as mapping and folding reusable. Functional languages differ in strictness and effect handling; the paradigm does not imply that real programs never perform input or output.
The eight-page Preliminary Examination in Computer Science, Paper 1, Long Vacation 2003. Original source: Released examination archive, member
4213-1.pdf. Printed pp. 2–3 cover functional programming, p. 4 covers algorithms, pp. 5–6 cover imperative programming, and pp. 7–8 cover digital electronics. The timing diagram on printed p. 8 permits a new clock cycle pulse immediately after a cycle that rearms the circuit.Released examination archive, member
4208.pdf. The original eight-page paper identifies the preliminary examination held on 17 June 2014. Questions 1–4 concern functional programming and Questions 5–8 concern analysis of algorithms. Question 5(b) permits signed integers but prints a bound containing ; for nonpositive inputs the meaningful extension uses . Haskell 2026-10-24
A functional programming language with parametric polymorphism and lazy evaluation. The code examples here use the Haskell 2010 Language Report specification.
Michael R. Clarkson Created 2026-10-14 Updated 2026-11-05
Michael R. Clarkson is a computer scientist whose teaching connects practical computer programming with reasoning about correctness. His work includes OCaml Programming: Correct + Efficient + Beautiful by Michael R. Clarkson and others, which develops functional programming, data structures and methods for specifying and checking program behaviour.[ref]
8.3 Module Documentation. Module implementation, abstraction functions and representation invariants
One characteristic example separates an abstraction function from a representation invariant. A list can represent a mathematical set, but an implementation that assumes no duplicate entries must maintain that condition after every operation. The explanation shows how an abstract interface is justified by concrete representation rules.[ref]
Portrait of Michael R. Clarkson
. Portrait identified on the Cornell University profile.This is the 13 June 2017 preliminary examination. Questions 1–4 concern functional programming; Questions 5–8 concern algorithm design and analysis of algorithms. All 35 printed subparts are answered. Source paper: released examination archive, member
a10097w1-1.pdf.The Haskell definitions use separate question namespaces. For Question 1, hide the locally defined names with
import Prelude hiding ((.), zipWith, uncurry); for Question 4 use import Prelude hiding (scanl). Alternative solve definitions are alternatives, not simultaneous duplicate declarations. Assume finite total puzzle inputs; infinite streams and partial values are treated explicitly where relevant. Operation counts separate numeric bit costs from list and comparison steps.[ref]This is the 12 June 2018 preliminary examination. Questions 1–4 concern functional programming; Questions 5–8 concern algorithm design and analysis of algorithms. Every printed option is answered here. The complete nine-page native paper is preserved in the Oxford examination release, member
a10097w1.pdf; the damaged duplicate rendition is not the source used here.The Haskell definitions below use finite total inputs unless lazy evaluation, strict functions or infinite lazy lists are being discussed. Separate questions use separate namespaces: in particular their
One constructors are unrelated, and the list-conversion function abs in Question 3 is distinct from the numeric Standard Prelude function. Treat alternative definitions of the same function separately. In a module for Question 2, use import Prelude hiding (zip, zipWith); in one for Question 3, use import Prelude hiding (abs, reverse, (++)). Other questions retain the Standard Prelude operations they use.[ref] Costs count constructor, comparison and ordinary arithmetic operations; integer bit costs and evaluating arbitrary element values are separate.Choose each team once using
teams, then scan every match with that team as the reference perspective:data Results = Results Team [(Int,Int)]
extract :: [[Match]] -> [Results]
extract days = [Results t (scores t) | t <- teams days]
where
games = concat days
scores t = concatMap (contribution t) games
contribution t (Match a ga b gb)
| t == a = [(ga,gb)]
| t == b = [(gb,ga)]
| otherwise = []In a valid match the teams are distinct. The first guard records the first team's goals-for and goals-against; the second reverses that perspective for the opponent. The common
games binding preserves day/match order, although the result does not need a chronological ordering condition. Each team receives exactly one record because teams has no duplicates. The algorithm makes one scan per team; it deliberately prioritizes a transparent functional programming definition over an unrequested performance improvement. Python (programming language) Created 2026-10-13 Updated 2026-11-05
Python is a general-purpose programming language with dynamic typing, functions, software classes, exception handling and modules. It supports procedural, object-oriented programming and functional programming. Guido van Rossum developed it to combine readable high-level data types with extensibility and access to operating system facilities; he began the implementation in 1989 and released it publicly in 1991.[ref]
General Python FAQ. What is Python? and Why was Python created in the first place?
The standard-library
ast module exposes Python abstract syntax trees. For example, parsing 2 + 3 * 4 in expression mode produces an addition whose right operand is a multiplication: the tree records operator precedence, and ordinary integer arithmetic evaluates the expression to 14. The abstract syntax tree can be inspected or transformed before compilation. The tree examples here use the Python 3.14 schema, since the schema can change between language versions.[ref] Scala 2026-10-24
A programming language supporting object-oriented programming and functional programming. Its traits support reusable mixin behavior, while type variance controls how parameterized types participate in subtyping. The Scala 2 and Scala 3 language versions differ in some syntax and typing details; examples should state the version relevant to a particular claim. Official documentation: docs.scala-lang.org
