import { anyComplex } from './complex.js' export default function create(pmath) { const complex = pmath('complex') return pmath('add', [anyComplex, // naive, but this is just a P-o-C (...addends) => { let sum = complex(addends[0]) for (let i = 1; i < addends.length; ++i) { const addend = complex(addends[i]) sum.re += addend.re sum.im += addend.im } return sum }]) }