Functional Programming Flashcards
FP properties?
Without side effects
Immutable
Higher order functions
Lazy
What is a side effect?
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.
What is referential transparency?
A function is RT if it can be replaced by a value and not change the behavior.
What is a Monad?
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.
What are some common Monad types?
Option[A]
Try[A]
Future[A]
What is the difference between Iteration and Observation?
Iteration: Client asks if there are elements left and pulls the next element.
Observation: Datasource pushes the next available element to client
Aggregation functions?
Compared to element-wise operations, it groups multiple items together and apply a reduction.