11 - Fundamentals of Functional Programming Flashcards

1
Q

What is a programming paradigm?

A

A method of programming.

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

What are declarative programming languages?

A

Languages that declare or specify what properties a result should have.

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

What are procedural programming languages?

A

Languages where the programmer specifies the steps that must be carried out to achieve a result.

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

What is the problem with procedural programming languages?

A

The value of a variable can change throughout the program, which may impact several subroutines negatively.

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

What is the functional programming paradigm?

A

Where each line of code is made up of calls to a function, which may in turn be made of other functions or return a value.

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

What are the advantages of functional programming?

A

Allows programs to be defined as a series of abstractions based on other functions, rather than a complex series of steps.
Abstractions lead to fewer errors in implementation.
Functions are re-usable
No concurrency issues.
Easier to test and debug.

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

What is a function type?

A

It describes the structure of a function, including the data type of the parameters and output.

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

What is the domain of a function?

A

The set of data of the same type, which are inputs of a function.

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

What is the co-domain of a function?

A

The set of values from which the output values are chosen.

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

What is the range of a function?

A

The actual values used in the output of a function.

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

What does a function do?

A

Maps the domain to the co-domain.

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

What is the partial application of a function?

A

Process of partially applying a function to create an intermediate function that performs part of the calculation.

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

What is function composition?

A

The process of creating a new function by combing existing functions together.

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

What is a first-class object?

A

Any object that can be used as an argument or as the result of a function call.

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

What is a higher order function?

A

A function that takes a function as its argument or produces a function as the result or both.

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

What does the map function do?

A

Applies a function to every element within a list and returns a list of results.

17
Q

What does the filter function do?

A

Processes a list and creates a new list whose elements match certain criteria.

18
Q

What does the fold function do?

A

Takes a list of values and reduces it to a single value, by a recursive process where the function is processed until the list is empty.

19
Q

What does foldr do?

A

Perform the fold function from the rightmost value.

20
Q

What does foldl do?

A

Perform the fold function from the leftmost value.

21
Q

What is a list?

A

A collection of data items of the same type.

22
Q

What is an identifier?

A

The name given to a list.

23
Q

What is the head of a list?

A

The first element in a list.

24
Q

What is the tail of a list?

A

All elements in a list apart from the head.

25
What is the length of a list?
The number of elements in the list.