Save
Computer Science A level
Paper 1
Fundamentals of Functional Programming
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Shana Seruwo
Visit profile
Cards (37)
What are the features of functional programming?
Statelessness
and
Immutability
Functions are used as the fundamental building blocks
No
side affects
What is a function
a
rule
that for each element of some set A of
inputs
, assigns an
output
chosen from a set B but without necessarily using every member of
B.
What is a domain?
A domain is a set from which the
function's
input values are chosen
What is a co-domain
a set from which the functions
outputs
values are chosen
What is a first class object?
something that:
Can be assigned to a
variable
appear in an
expression
be assigned as an
argument
be returned in a
function
call
Give some examples of first class objects?
integers
floats
characters
strings
What does it mean when functions are refered to as statelesss
do not rely on or alter any state outside of their
scope
What is immutability?
once a
data structure
is created, it cannot be changed
What is functional programming?
A programming
paradigm
based
on functions
View source
What defines a higher order function?
It
takes
or
returns
a
function
View source
What does the map function do?
Applies
a function to a
list
of
elements
View source
If you want to subtract 2 from each element in a list, which function would you use?
Map function
View source
What is the purpose of the filter function?
Returns elements that meet a
specific
condition
View source
If you want to keep only elements greater than 1 from a list, which function would you use?
Filter function
View source
What does folding a list do?
Reduces the list to a single
value
View source
What is another name for folding?
Reducing
View source
What does the fold function require?
An
operator
, a
starting
number, and a
list
View source
What type of fold will you be asked questions about?
Fold
left
View source
What is the specification for functional language programs?
Show
experience
of constructing
simple
programs
View source
What is a
higher-order
function
?

A function that takes or returns another function
View source
What does the map function return?
A
list
of results after applying a function
View source
What does the filter function produce?
A new data structure with
matching elements
View source
What does the reduce or fold function do?
Reduces a
list
to a single value
View source
What is the main focus of the fold function?
To apply a
combining function
repeatedly
View source
What is the difference between fold left and fold right?
It determines how
recursion
works
View source
What is the expected knowledge for using higher-order functions?
Experience with
map
,
filter
, and
fold
View source
What are the key characteristics of higher-order functions?
Take a function as an
argument
Return a function as a
result
Do both of the
above
View source
What are the steps involved in using the map function?
Provide a function to apply
Provide a list of
elements
Return a new list with
results
View source
What are the steps involved in using the filter function?
Provide a
condition
to check
Provide a list of
elements
Return a new list with
matching elements
View source
What are the steps involved in using the fold function?
Provide an
operator
(e.g., +, -)
Provide a
starting number
Provide a list of values
Return a single
reduced value
View source
What is the difference between fold left and fold right?
Fold left
processes
elements
from the start
Fold right
processes elements from the end
View source
What is the
composition
of
functions
?

the idea that you can combine two functions in order to get a new function
What is function application?
the process of giving particular
inputs
to a
function
What is partial function application
is the process of decomposing
multi-arguments
functions
into smaller functions with less arguments
Why can functional programming easily take advantage of parallel processing
its focus on
immutability
,
pure functions
, and the absence of
shared mutable state
Explain the purpose of fold/reduce in functional programming?
Fold takes a
list
of values and returns a single value by applying
combining function
Explain how the function map double [1,2,3,4] works (double x :: x*2)
the map applies the double function to each list item
the map applies double first the
head
of the list and then a
recursive
call is made on the
tail
of the list