Glen Whitney
c429c19dfe
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.
7 lines
141 B
JavaScript
7 lines
141 B
JavaScript
export const mod = {
|
|
'any,any': ({
|
|
subtract,
|
|
multiply,
|
|
quotient}) => (a,m) => subtract(a, multiply(m, quotient(a,m)))
|
|
}
|