Last active
April 4, 2019 10:25
-
-
Save dewey92/020323ca2b30835387d4c293db1633cf to your computer and use it in GitHub Desktop.
Endomorphism Monoid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const endoFunc = createMonoid({ | |
| indentity: x => x, | |
| semigroup: compose, | |
| }); | |
| const incr = x => x + 1; | |
| const square = x => x * x; | |
| log(endoFunc.id) // x => x | |
| log(endoFunc.append(square, incr)(9)) // => 100 | |
| log(endoFunc.append(incr, square)(9)) // => 82 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment