refactor: Make generics more strict via templates

This commit also adds a built-in `typeOf` function to every PocomathInstance.
  It also adds a notation (prefix '!') for "eager" templeates that
  instantiate themselves for all types immediately upon definition.
This commit is contained in:
Glen Whitney 2022-08-01 02:57:38 -07:00
parent fd3d6b2eb3
commit 36e7b750ce
23 changed files with 233 additions and 44 deletions

View file

@ -30,4 +30,11 @@ describe('number', () => {
it('computes gcd', () => {
assert.strictEqual(math.gcd(15, 35), 5)
})
it('compares numbers', () => {
assert.ok(math.smaller(12,13.5))
assert.ok(math.equal(Infinity, Infinity))
assert.ok(math.largerEq(12.5, math.divide(25,2)))
})
})