feat(gcd,lcm): Allow arbitrarily many arguments
And add an 'associate' predicate for two complex numbers to check the results
This commit is contained in:
parent
1b8314c0cc
commit
880efac15b
5 changed files with 31 additions and 0 deletions
|
@ -3,6 +3,7 @@ import {reducingOperation} from './reducingOperation.mjs'
|
|||
export * from './Types/generic.mjs'
|
||||
|
||||
export const add = reducingOperation
|
||||
export const gcd = reducingOperation
|
||||
export {lcm} from './lcm.mjs'
|
||||
export {mean} from './mean.mjs'
|
||||
export {mod} from './mod.mjs'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import {reducingOperation} from './reducingOperation.mjs'
|
||||
|
||||
export const lcm = {
|
||||
'T,T': ({
|
||||
'multiply(T,T)': multT,
|
||||
|
@ -5,3 +7,4 @@ export const lcm = {
|
|||
'gcd(T,T)': gcdT
|
||||
}) => (a,b) => multT(quotT(a, gcdT(a,b)), b)
|
||||
}
|
||||
Object.assign(lcm, reducingOperation)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue