Functional Programming Flashcards
What is a first class object?
Any object that can be passed as an argument or can be returned by a function.
A function is a first class object.
What is an argument?
The data that is passed through a function when its called.
What is a highest order function?
A function which can accept another function as an argument
What are the domain and codomain?
The domain contains the inputs, whilst the codomain contains the outputs
What is a partial function?
A partial function fixes the number of arguments that can be passed, in a function which contains any number of arguments
What is Function Composition?
The process of creating a new function by combining two existing functions.
What is Function Composition?
The process of creating a new function by combining two existing functions.
What is the map function?
The map function applies a given function to every element within a list and returns the list of results
What is the filter function?
A function that processes a list and creates a new list that contains elements that match a certain criteria
What is the fold function?
A function that takes a list of values and reduces it to a single value by applying a combining function
What is a list?
A set of data items of the same type, stored under one identifier
What is the head?
The first element in the list
What is the tail?
All the elements apart from the head
How does a map function work?
The map function applies the function to each list element by applying it to the head first. A recursive call is then made on the tail of the list.