2.7 Fundamentals of functional programming Flashcards

1
Q

Define functional programming paradigm

A

A language where each line of code is made up of calls to a function, which in turn may be made up of other functions, or result in a value

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

Define declarative programming languages

A

Languages that specify what properties a result should have, e.g. results based on functions

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

Define procedural programming languages

A

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

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

What are the benefits of a functional programming paradigm?

A
  • Program requirements may be better defined as a series of abstractions based on functions
  • Broader abstractions can lead to fewer errors in implementation
  • Functions can be applied at any level of data abstraction making them highly reusable within a program
  • Functional code is easier to test and debug
  • There are no concurrency issues
  • In multi-processor environments, the order functions are evaluated in is not critical
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define function type

A

Refers to the way in which the expression is created, for example, integer of the domain and co-domain where f: a->b is the type of function, a is the argument type and b is the output type

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

Define domain

A

A set of data of the same type which are the inputs of a function

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

Define co-domain

A

The set of values from which the outputs of a function must be drawn

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

Define first-class object

A

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

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

Define higher order function

A

A function that takes a function as its inputs or creates a function as its output

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

Define function application

A

The process of calculating the result of a function by passing it some data to produce a result

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

Define partial application of a function

A

The process of applying a function by creating an intermediate function by fixing some of the arguments to the function

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

Define function composition

A

Combining two or more functions to create more complex functions

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

Define map function

A

A function that generates an output list from an input list by applying a function to each element in the input list

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

Define filter function

A

A method of creating a subset based on specified criteria

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

Define reduce / fold function

A

A method of reducing a list to a single element by combining the elements using a function

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