feat(poortf): add concept of 'author' to an imp of a TF
And make it so that if the same author adds imps again, they replace the previous imps from that author. Use this feature to avoid the explicit check for double-inclusion in subtract, and test it worked.
This commit is contained in:
parent
2c1b6c3364
commit
00a7f79552
4 changed files with 34 additions and 13 deletions
|
@ -1,9 +1,9 @@
|
|||
export default function create(pmath) {
|
||||
const add = pmath('add')
|
||||
const negate = pmath('negate')
|
||||
if (!pmath.subtract) { // avoid double definition at cost of extensibility
|
||||
pmath('subtract', [args => args.length === 2,
|
||||
(x, y) => add(x, negate(y))])
|
||||
}
|
||||
return pmath(
|
||||
'subtract',
|
||||
[args => args.length === 2, (x, y) => add(x, negate(y))],
|
||||
create)
|
||||
return pmath.subtract
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue