Learning objective
Functional language programs: Show experience of constructing simple programs in a functional programming language. The following is a list of functional programming languages that could be used: • Haskell • Standard ML • Scheme • Lisp. Other languages with built-in support for programming in a functional paradigm as well as other paradigms are: • Python • F# • C# • Scala • Java 8 • Delphi XE versions onwards • VB.NET 2008 onwards. Higher-order functions. A function is higher-order if it takes a function as an argument or returns a function as a result, or does both. Have experience of using the following in a functional programming language: • map • filter • reduce or fold. map is the name of a higher-order function that applies a given function to each element of a list, returning a list of results. filter is the name of a higher-order function that processes a data structure, typically a list, in some order to produce a new data structure containing exactly those elements of the original data structure that match a given condition. reduce or fold is the name of a higher-order function which reduces a list of values to a single value by repeatedly applying a combining function to the list values.
Read the explanation, check the common trap, then practise with flashcards and questions.
At a glance
0
Flashcards
0
Questions
Topic
Writing functional programs
Subtopic
Functional language programs
Study support
Understand this objective
Quick explanation
Functional language programs: Show experience of constructing simple programs in a functional programming language. The following is a list of functional programming languages that could be used: • Haskell • Standard ML • Scheme • Lisp. Other languages with built-in support for programming in a functional paradigm as well as other paradigms are: • Python • F# • C# • Scala • Java 8 • Delphi XE versions onwards • VB.NET 2008 onwards. Higher-order functions. A function is higher-order if it takes a function as an argument or returns a function as a result, or does both. Have experience of using the following in a functional programming language: • map • filter • reduce or fold. map is the name of a higher-order function that applies a given function to each element of a list, returning a list of results. filter is the name of a higher-order function that processes a data structure, typically a list, in some order to produce a new data structure containing exactly those elements of the original data structure that match a given condition. reduce or fold is the name of a higher-order function which reduces a list of values to a single value by repeatedly applying a combining function to the list values
- This point belongs to Writing functional programs, especially Functional language programs.
- You need to be able to functional language programs: Show experience of constructing simple programs in a functional programming language. The following is a list of functional programming languages that could be used: • Haskell • Standard ML • Scheme • Lisp. Other languages with built-in support for programming in a functional paradigm as well as other paradigms are: • Python • F# • C# • Scala • Java 8 • Delphi XE versions onwards • VB.NET 2008 onwards. Higher-order functions. A function is higher-order if it takes a function as an argument or returns a function as a result, or does both. Have experience of using the following in a functional programming language: • map • filter • reduce or fold. map is the name of a higher-order function that applies a given function to each element of a list, returning a list of results. filter is the name of a higher-order function that processes a data structure, typically a list, in some order to produce a new data structure containing exactly those elements of the original data structure that match a given condition. reduce or fold is the name of a higher-order function which reduces a list of values to a single value by repeatedly applying a combining function to the list values.
- Use the linked flashcards and practice questions to check recall, then practise applying the idea in an exam-style answer.
Why it matters
This objective helps connect Functional language programs to exam-style questions, flashcards, and revision notes for Writing functional programs.
Quick student answer
In Python, what is the result of applying map(lambda x: x * 2, [1, 3, 5]) and converting the result to a list?
Direct answer
The result is [2, 6, 10].
Key terms
- Higher-order function: A function that takes another function as an argument, returns a function as a result, or does both.
- Functional programming: A programming approach in which functions are central to constructing programs; in this topic, programs use operations such as map, filter and reduce or fold.
Common trap
Confusing map and filter: Use filter for selection based on a condition and map for applying a function to every element. If both are needed, apply them as separate stages in an appropriate order.
Related questions
Try this as a practice card
Question 1 of 4
Choose an answer, get feedback, then move sideways through the set.
Flashcard prompts
Flip through the key recall cards
Flashcard 1 of 4
Revision tools
