Skip to main content
EnglandComputer ScienceSyllabus dot point

What are higher-order functions, and how do map, filter and fold process lists in functional programming?

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.

Generated by Claude Opus 4.813 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

Eduqas wants you to explain higher-order functions, describe the map, filter and fold (reduce) operations and what each produces, explain function composition, and describe how lists are processed by their head and tail. These are the practical tools of functional programming, taught in Haskell.

The answer

Higher-order functions

Map, filter and fold

Function composition and head/tail processing

Examples in context

Map, filter and fold are everywhere in modern programming, not just Haskell: JavaScript, Python and Java all provide them, and they are the backbone of large-scale data processing frameworks (MapReduce, Spark) precisely because pure, composable operations parallelise so well. A web app might filter a product list by category, map each to a display card, and fold prices to a total, exactly the pipeline above. This builds directly on the functional paradigm and recursion, and shows why first-class functions matter.

Try this

Q1. What does the map operation produce when applied to a list? [1 mark]

  • Cue. A new list of the same length, with the given function applied to (transforming) every element.

Q2. Define a higher-order function. [1 mark]

  • Cue. A function that takes one or more functions as arguments, or returns a function as its result.

Q3. Using map, filter and fold, describe how to find the total of all numbers greater than 1010 in a list. [2 marks]

  • Cue. Filter to keep numbers greater than 1010, then fold with addition (starting value 00) to sum them (map is not needed unless transforming first).

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 20216 marksExplain what a higher-order function is, and describe the map, filter and fold (reduce) operations, stating what each produces when applied to a list.
Show worked answer →

Higher-order function (up to 2 marks): a function that takes one or more functions as arguments, or returns a function as its result; this is possible because functions are first-class values.

Map (up to 1 mark): applies a given function to every element of a list, producing a new list of the same length with each element transformed (for example doubling every number).

Filter (up to 2 marks): tests every element of a list against a given Boolean function (predicate) and produces a new list containing only the elements that satisfy it (for example keeping only the even numbers); the result may be shorter.

Fold/reduce (up to 1 mark): combines all the elements of a list into a single value using a given function and a starting value (for example summing a list to one total).

Markers reward the takes-or-returns-a-function definition, and correct descriptions of map (transform each, same length), filter (keep those passing a test), and fold (combine to a single value).

Eduqas 20225 marksA list of numbers is given. Using map, filter and fold, describe how you would calculate the sum of the squares of only the odd numbers in the list, and explain what is meant by function composition.
Show worked answer →

Using the operations (up to 3 marks): first filter the list to keep only the odd numbers (a predicate testing oddness); then map the squaring function over the result to square each; then fold with addition and a starting value of 00 to combine them into a single total.

Function composition (up to 2 marks): combining two or more functions so that the output of one becomes the input of the next, creating a new function; for example composing "square" after "filter odds" so the whole pipeline is a single function applied to the list.

Markers reward the filter-then-map-then-fold pipeline in a sensible order and a correct definition of composition (output of one function feeds the next).

Related dot points

Sources & how we know this