Writing Functional Programs (AQA A-Level Computer Science): Flashcards
📚Flashcards
Practise the cards
10 cards from this deck
ShowHide
Practise the cards
10 cards from this deck
Higher-order function definition
Higher-order function definition
Takes functions as inputs or produces a function as output
Map function purpose
Map function purpose
Applies a given function to every element in a list
Filter function purpose
Filter function purpose
Creates new list with only elements meeting specific criteria
Predicate function definition
Predicate function definition
Function that returns a Boolean value (TRUE or FALSE)
Reduce/fold function purpose
Reduce/fold function purpose
Combines list values into single value using specified function
List data type rule
List data type rule
All elements must share the same data type
Head of a list
Head of a list
The first element in a list
Tail of a list
Tail of a list
All elements in the list apart from the head
How reduce/fold processes a list
How reduce/fold processes a list
Recursively applies function until list is empty
When a list can be empty
When a list can be empty
When first created or after all data removed
