10 lines
303 B
JavaScript
10 lines
303 B
JavaScript
|
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
|
||
|
}
|