Functional Programming Flashcards

1
Q

Functor

A

**Deals with effects.

Categorization, the mapping between categories.

It is used to map functions.

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

Monoid

A

**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.

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

Monad

A

**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’.

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

Applicative

A

**Deals with effects in parallel.

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

Composition

A

“compose” function

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

Aggregation / Combination

A

“combine” / “reduce”
functions

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

Iteration

A

“fold” function

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

Working with effects

A

Mixing, chaining, parallel

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

Mixing Effects

A

“map” function

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

Non-Effects

A

“return” function

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

Chaining effects in series

A

“bind” function or
“flatmap” function

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

Effects in parallel

A

“apply” function
“zip” function

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

Pulling effects out of a list

A

“sequence” function
“traverse” function

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

Principles of Statically types Functional Programming

A

*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.

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

Pairwise operations

A

When the same operation works on two values again and again, it’ll work in lists.

addition, concatenating, multiplication, etc.

“reduce” operation

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

Parallelization

A

spread work across machines, etc.
for:
1 + 2 + 3 + 4
a monoid would allow you to distribute the work.

17
Q

Identity Element

A

The “no-operation” value for a given operation.

examples:
addition/subtraction with 0

multiplication/division with 1

concatenation with “”

18
Q

“Combine”

A

Combines two values to make another of the same kind.

19
Q

“Reduce”

A

reduces a list to a single value by using “combine” repeatedly.

20
Q

“Map”

A

Lifts functions into an effects world

21
Q

“Return”

A

Lifts values into an effects world

22
Q

“Bind”

A

Converts diagonal/branching relationships into a two rail relationship.

23
Q

“Apply | Lift”

A

Combines two effects in parallel

24
Q

A monad’s criteria is

A

A Monad is an effect type: async<> list<> option<> …
Plus a return function …
Plus a bind function that converts diagonal traversal to horizontal (mitigates branching) world-crossing …
Bind / Return must have sensible implementations (the monad laws)

25
Q

A Functor’s criteria

A

A functor is an effect type,
plus a map function that shifts into the “effects” world.