mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-06 02:26:43 +00:00
add Homomorphism
This commit is contained in:
parent
72fe6956aa
commit
1d15590eba
1 changed files with 11 additions and 0 deletions
11
readme.md
11
readme.md
|
|
@ -51,6 +51,7 @@ __Table of Contents__
|
|||
* [Morphism](#morphism)
|
||||
* [Endomorphism](#endomorphism)
|
||||
* [Isomorphism](#isomorphism)
|
||||
* [Homomorphism](#homomorphism)
|
||||
* [Catamorphism](#catamorphism)
|
||||
* [Anamorphism](#anamorphism)
|
||||
* [Hylomorphism](#hylomorphism)
|
||||
|
|
@ -696,6 +697,16 @@ coordsToPair(pairToCoords([1, 2])) // [1, 2]
|
|||
pairToCoords(coordsToPair({x: 1, y: 2})) // {x: 1, y: 2}
|
||||
```
|
||||
|
||||
### Homomorphism
|
||||
|
||||
A homomorphism is just a structure preserving map. In fact, a functor is just a homomorphism between categories as it preserves the original category's structure under the mapping.
|
||||
|
||||
```js
|
||||
A.of(f).ap(A.of(x)) == A.of(f(x))
|
||||
|
||||
Either.of(_.toUpper).ap(Either.of("oreos")) == Either.of(_.toUpper("oreos"))
|
||||
```
|
||||
|
||||
### Catamorphism
|
||||
|
||||
A `reduceRight` function that applies a function against an accumulator and each value of the array (from right-to-left) to reduce it to a single value.
|
||||
|
|
|
|||
Loading…
Reference in a new issue