@@ -35,9 +35,8 @@ __Table of Contents__
35
35
* [ Lambda Calculus (TODO)] ( #lambda-calculus-todo )
36
36
* [ Lazy evaluation (TODO)] ( #lazy-evaluation-todo )
37
37
* [ Functor (TODO)] ( #functor-todo )
38
- * [ Applicative (TODO)] ( #applicative-todo )
39
38
* [ Applicative Functor (TODO)] ( #applicative-functor-todo )
40
- * [ Monoid (TODO) ] ( #monoid-todo )
39
+ * [ Monoid] ( #monoid )
41
40
* [ Monad (TODO)] ( #monad-todo )
42
41
* [ Comonad (TODO)] ( #comonad-todo )
43
42
* [ Morphism (TODO)] ( #morphism-todo )
@@ -588,20 +587,31 @@ object.map(compose(f, g)) ≍ object.map(g).map(f)
588
587
589
588
## Pointed Functor (TODO)
590
589
591
- ## Applicative (TODO)
590
+ ## Applicative Functor (TODO)
591
+
592
592
593
- ## Applicative Functore (TODO)
593
+ ## Monoid
594
594
595
- ## Monoid (TODO)
595
+ An object with a function that "combines" that object with another of the same type
596
+ and an "empty" value, which can be added with no effect.
596
597
597
- An object with a function that "combines" that object with another of the same type.
598
+ One simple monoid is the addition of numbers
599
+ (with ` __add__ ` as an addition function and ` 0 ` as an empty element):
600
+
601
+ ``` python
602
+ >> > assert 1 + 1 + 0 == 2
603
+ >> >
604
+ ```
598
605
599
- One simple monoid is the addition of numbers :
606
+ Tuples, lists, and strings are also monoids :
600
607
601
608
``` python
602
- 1 + 1 # 2
609
+ >> > assert (1 ,) + (2 ,) + () == (1 , 2 )
610
+ >> > assert [1 ] + [2 ] + [] == [1 , 2 ]
611
+ >> > assert ' a' + ' b' + ' ' == ' ab'
612
+ >> >
603
613
```
604
- In this case number is the object and ` + ` is the function.
614
+
605
615
606
616
## Monad (TODO)
607
617
0 commit comments