Functional Programming Flashcards

1
Q

FP properties?

A

Without side effects
Immutable
Higher order functions
Lazy

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

What is a side effect?

A

A function has one if it modifies state outside of its scope or has an observable interaction with its calling functions oir the outside world beyond its return value.

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

What is referential transparency?

A

A function is RT if it can be replaced by a value and not change the behavior.

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

What is a Monad?

A

It is a design pattern that wraps a value. It has an identity function and a flatMap function. They are used to deal with side effects.

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

What are some common Monad types?

A

Option[A]
Try[A]
Future[A]

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

What is the difference between Iteration and Observation?

A

Iteration: Client asks if there are elements left and pulls the next element.
Observation: Datasource pushes the next available element to client

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

Aggregation functions?

A

Compared to element-wise operations, it groups multiple items together and apply a reduction.

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