Complete a recursive counting template

A temperature logger represents its readings using the following data definition:

  • Readings is either Empty or Link(value, next).
  • value is an integer temperature in degrees Celsius.
  • next is another Readings value.
  • Every chain is finite and ends with Empty.

Complete this plan for counting readings strictly above 25°C. For the operation blank, choose addition, multiplication, or maximum.


When the input is Empty, return . When the input is Link(value, next), apply the same counting function to . Use to combine that returned count with a contribution of 1 if value exceeds 25, or 0 otherwise.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Data Definitions and Program Structure Questions: