Fundamentals of Functional Programming Flashcards
What is a function?
A rule that for each element in some set of inputs, assigns an output chosen from set B, but without necessarily using every member of B.
What defines a First-Class Object?
- appear in objects
- be assigned to a variable
- be assigned as arguments
- be returned in function calls
What is a Partial Function?
Takes advantage of the inability of a function to take more than one input.
In partial function application, one of the arguments is fixed, leading to a more restricted, specialised function.
What is Functional Composition?
Act of combining two functions to create a new function.
Creates a benefit that the user can use the functions both separately or in conjunction.
How can you combine two functions?
As long as the domain of one of the functions is the co-domain of the other.
Indicated by o symbol
Explain the purpose of the REDUCE or FOLD function in a functional programming function:
Reduces a list of values to a single value by applying a combining function
What is a Higher-Order Function?
A function that takes a function as an argument
What does MAP do?
applies the function ‘x’ to each list element