feat: Initial core of picomath
Implements a totally simplistic "poortf" mutable typed function and a picomath instance generator, as well as the very beginnings of a number type and one generic function and a default full picomath instance. Also provides some tests which serve as usage examples.
This commit is contained in:
parent
36cc91ca95
commit
536656bfe8
14 changed files with 1627 additions and 2 deletions
9
generic/subtract.js
Normal file
9
generic/subtract.js
Normal file
|
@ -0,0 +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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue