What is the functional programming paradigm, and how do pure functions, immutability and recursion differ from imperative programming?
The functional paradigm: functions as first-class values, pure functions and referential transparency, immutability and the avoidance of side effects, the use of recursion instead of iteration, and how functional differs from imperative programming.
An Eduqas Component 2 answer on the functional paradigm: functions as first-class values, pure functions and referential transparency, immutability and avoiding side effects, recursion in place of iteration, and how functional programming differs from the imperative approach.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
Eduqas wants you to explain the functional paradigm: functions as first-class values, pure functions and referential transparency, immutability and avoiding side effects, using recursion instead of iteration, and how functional differs from imperative programming. Eduqas teaches this with Haskell.
The answer
Functions as first-class values
Pure functions, referential transparency and immutability
Recursion versus iteration, and functional versus imperative
Examples in context
Functional ideas are increasingly mainstream: immutability and pure functions make concurrent and parallel code far safer, which is why languages like Haskell, and functional features in Python, JavaScript and Java, are widely used for data processing and large-scale systems. Referential transparency is what lets compilers and runtimes optimise and cache aggressively. Eduqas teaches this paradigm in Haskell, and it connects to the recursion topic from Component 1 and to the higher-order functions (map, filter, fold) in the next dot point.
Try this
Q1. State the two properties of a pure function. [2 marks]
- Cue. Its output depends only on its inputs, and it has no side effects (changes nothing external).
Q2. What does it mean for data to be immutable? [1 mark]
- Cue. Once created, the data cannot be changed; operations produce new values rather than modifying existing ones.
Q3. How is repetition achieved in functional programming, and why not loops? [2 marks]
- Cue. By recursion; loops rely on a changing counter (mutable state), which the functional paradigm avoids.
Exam-style practice questions
Practice questions written in the style of WJEC Eduqas exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
Eduqas 20205 marksExplain what is meant by a pure function and by referential transparency, and state two benefits of writing functions without side effects.Show worked answer →
Pure function (up to 2 marks): a function whose output depends only on its input arguments and which has no side effects (it does not change any external state or rely on anything outside its parameters); given the same inputs it always returns the same output.
Referential transparency (up to 1 mark): the property that a function call can be replaced by its result value without changing the program's behaviour, which follows from purity.
Benefits (up to 2 marks): easier to test and reason about (output depends only on inputs); easier to run in parallel (no shared mutable state to conflict); results can be cached (memoised); fewer bugs from unexpected state changes.
Markers reward the same-input-same-output, no-side-effect definition of purity, the replace-call-with-result idea of referential transparency, and two valid benefits.
Eduqas 20225 marksCompare the functional and imperative programming paradigms, referring to state, side effects and how repetition is achieved.Show worked answer →
Imperative (up to 2 marks): programs are sequences of statements that change the program's state (variables) step by step; repetition is usually achieved with loops; side effects (changing variables, input/output) are normal.
Functional (up to 2 marks): programs are built by composing functions that avoid changing state; data is immutable; repetition is usually achieved through recursion rather than loops; pure functions avoid side effects.
Comparison point (up to 1 mark): the imperative style focuses on how to do something (the steps), while the functional style focuses on what to compute (expressions and function composition), which makes functional code easier to parallelise and reason about but sometimes less intuitive for stateful tasks.
Markers reward the change-state-with-loops description of imperative, the immutable-recursion-no-side-effects description of functional, and a valid comparison (how versus what, parallelism).
Related dot points
- Higher-order functions and list processing: passing and returning functions, the map, filter and fold (reduce) operations, function composition, and how lists are processed by the head and tail.
An Eduqas Component 2 answer on higher-order functions: passing and returning functions, the map, filter and fold (reduce) operations, function composition, and processing lists by their head and tail.
- Procedural and object-oriented programming: subroutines (procedures and functions) with parameters and return values, and the object-oriented concepts of classes and objects, encapsulation, inheritance and polymorphism.
An Eduqas Component 1 answer on programming paradigms: procedures and functions with parameters passed by value or reference, and the object-oriented concepts of classes, objects, encapsulation, inheritance and polymorphism, with their benefits for large programs.
- Recursion and algorithmic complexity: the base case and recursive case, how recursion uses the call stack, and Big-O notation for the time and space complexity of algorithms (constant, logarithmic, linear, polynomial and exponential).
An Eduqas Component 1 answer on recursion and complexity: the base case and recursive case, how recursion uses the call stack and can cause stack overflow, and Big-O notation for measuring how an algorithm's time and space scale with input size.
- Programming principles: primitive and composite data types, variables and constants, scope and lifetime, and the three programming constructs of sequence, selection and iteration used to build structured programs.
An Eduqas Component 1 answer on programming principles: the primitive data types, variables versus constants, local versus global scope and lifetime, type conversion, and the three programming constructs sequence, selection and iteration.
- The operating system: its role as the interface between the user, applications and hardware, process management and CPU scheduling, the handling of interrupts, and the management of input/output and the file system.
An Eduqas Component 2 answer on the operating system: its role as the interface between user, applications and hardware, process management and CPU scheduling algorithms, the handling of interrupts, and the management of input/output and the file system.
Sources & how we know this
- WJEC Eduqas GCE AS/A Level Computer Science specification (from 2015) — Eduqas (2015)