Functional Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a declarative programming language?

A

A language where the logic of a program is defined, rather than the control flow of computation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a procedural programming language?

A

A language where the control flow is defined rather than the logic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a first-class object?

A

Any object that can be passed as an argument to a function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a high-order function?

A

A function that takes another function as an argument, or a function that returns another function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the map function do?

A

It takes a list of elements and applies a function to each item in the list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the filter function do?

A

It returns a list of elements with specified values from another list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the reduce function do?

A

It recursively adds each successive element of a list, allowing for the entire lost to be represented as a single number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the head of a list?

A

The first element of a list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Give three advantages of functional programming paradigms

A

×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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly