picomath/generic/subtract.js
Glen Whitney 1c1ba91e48 feat: Invalidation and lazy reloading of implementations
The interface is a bit clunky, the "author" and the callback "data"
  have to be specified when adding (an) implementation(s) in order
  for this to work. But it does, and this is just a PoC, the interface
  could be cleaned up.
2022-03-25 13:09:50 -07:00

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
}