-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add Group specification * better property names * back to inverse * update dep chart * follow already well established patterns for dat dot
- Loading branch information
Showing
8 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
const {of, empty, concat, invert} = require('..'); | ||
|
||
/** | ||
### Group | ||
1. `g.concat(g.invert())` is equivalent to `g.empty()` (right inverse) | ||
2. `g.invert().concat(g)` is equivalent to `g.empty()` (left inverse) | ||
**/ | ||
|
||
const rightInverse = T => eq => x => { | ||
const g = T[of](x); | ||
|
||
const a = g[concat](g[invert]()); | ||
const b = T[empty](); | ||
return eq(a, b); | ||
}; | ||
|
||
const leftInverse = T => eq => x => { | ||
const g = T[of](x); | ||
|
||
const a = g[invert]()[concat](g); | ||
const b = T[empty](); | ||
return eq(a, b); | ||
}; | ||
|
||
module.exports = {rightInverse, leftInverse}; |
This file contains 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