feat: Implement subtypes

This should eventually be moved into typed-function itself, but for
  now it can be implemented on top of the existing typed-function.

  Uses subtypes to define (and error-check) gcd and lcm, which are only
  defined for integer arguments.

  Resolves #36.
This commit is contained in:
Glen Whitney 2022-07-30 04:59:04 -07:00
parent 4d38f4161c
commit c429c19dfe
35 changed files with 294 additions and 43 deletions

View file

@ -27,4 +27,7 @@ describe('number', () => {
assert.deepStrictEqual(no.sqrt(-16), no.complex(0,4))
})
it('computes gcd', () => {
assert.strictEqual(math.gcd(15, 35), 5)
})
})