logo

Topic study hub

Lists in functional programming

Official AQA 7517 section 4.12.3.

0

Objectives

5

Flashcards

7

Questions

36 min

Study time

AqaA LevelComputer ScienceFundamentals of functional programming

Choose a revision tool

Start revising Lists in functional programming

Syllabus checklist

What you need to know

0 objective pages available

List processing1 objectives
  • List processing: Be familiar with representing a list as a concatenation of a head and a tail. Know that the head is an element of a list and the tail is a list. Know that a list can be empty. Describe and apply the following operations: • return head of list • return tail of list • test for empty list • return length of list • construct an empty list • prepend an item to a list • append an item to a list. Have experience writing programs for the list operations mentioned above in a functional programming language or in a language with support for the functional paradigm. For example, in Haskell the list [4, 3, 5] can be written in the form head:tail where head is the first item in the list and tail is the remainder of the list. In the example, we have 4:[3, 5]. We call 4 the head of the list and [3, 5] the tail. [] is the empty list. 94

Key terms

HeadTail

Exam tips

  • Show the list after every operation: When tracing list processing, write the complete list after taking a tail, prepending, or appending.

Common mistakes

  • Confusing prepend and append: Prepend with [item] + xs. Append with xs + [item]. Check the position of the new item in the resulting list.

Practice preview

Continue by objective

Objectives are grouped by subtopic so students can jump straight to the exact skill they want to revise.