Functional Programming Flashcards
What is a declarative programming language?
A language where the logic of a program is defined, rather than the control flow of computation
What is a procedural programming language?
A language where the control flow is defined rather than the logic
What is a first-class object?
Any object that can be passed as an argument to a function
What is a high-order function?
A function that takes another function as an argument, or a function that returns another function
What does the map function do?
It takes a list of elements and applies a function to each item in the list
What does the filter function do?
It returns a list of elements with specified values from another list
What does the reduce function do?
It recursively adds each successive element of a list, allowing for the entire lost to be represented as a single number
What is the head of a list?
The first element of a list
Give three advantages of functional programming paradigms
×Functions are very abstract, so are less prone to errors
×Functions are easier to test because a function will always give the same output
×It is easier to reuse functions with any level of data abstraction