Glen Whitney
0069597a76
Also starts each PocomathInstance with no types at all, and uses the new situation to eliminate the need for a Complex "base case". Resolves #14. Resolves #13. Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: #15
11 lines
315 B
JavaScript
11 lines
315 B
JavaScript
export {Types} from './Types/Complex.mjs'
|
|
|
|
export const add = {
|
|
'...Complex': [['self'], ref => addends => {
|
|
if (addends.length === 0) return {re:0, im:0}
|
|
const seed = addends.shift()
|
|
return addends.reduce((w,z) =>
|
|
({re: ref.self(w.re, z.re), im: ref.self(w.im, z.im)}), seed)
|
|
}]
|
|
}
|