Functional Programming Flashcards
Functor
**Deals with effects.
Categorization, the mapping between categories.
It is used to map functions.
Monoid
**Deals with Combination or Aggregation.
AKA Abstract Data Types
Grouping, monoids are semigroups with identity.
A sort of circular relationship where a function builds itself into a structure.
For computer science we’re talking about abstract data types.
for example a string built from a set of characters can be considered a monoid. Concatenating each character together.
Monad
**Deals with chaining effects in series. Or chaining effects generating functions in series.
A monad is a structure that combines functions and wraps their return value as a type with additional computation.
Such as handling ‘null’ and ‘fail-state’.
Applicative
**Deals with effects in parallel.
Composition
“compose” function
Aggregation / Combination
“combine” / “reduce”
functions
Iteration
“fold” function
Working with effects
Mixing, chaining, parallel
Mixing Effects
“map” function
Non-Effects
“return” function
Chaining effects in series
“bind” function or
“flatmap” function
Effects in parallel
“apply” function
“zip” function
Pulling effects out of a list
“sequence” function
“traverse” function
Principles of Statically types Functional Programming
*Functions are things
*A function is a standalone, reusable thing.
– a function can be an input (strategy pattern in OOP)
– a function can be an output
*Composition is everywhere
– have to have an input or output, makes everything snap together.
Pairwise operations
When the same operation works on two values again and again, it’ll work in lists.
addition, concatenating, multiplication, etc.
“reduce” operation