picomath/generic/subtract.js

10 lines
249 B
JavaScript

export default function create(pmath) {
const add = pmath('add')
const negate = pmath('negate')
return pmath(
'subtract',
[args => args.length === 2, (x, y) => add(x, negate(y))],
create, pmath)
return pmath.subtract
}