pocomath/src/generic/reducingOperation.mjs

13 lines
312 B
JavaScript
Raw Normal View History

export * from './Types/generic.mjs'
export const reducingOperation = {
'undefined': () => u => u,
'undefined,...any': () => (u, rest) => u,
'any,undefined': () => (x, u) => u,
any: () => x => x,
'any,any,...any': ({
self
}) => (a,b,rest) => [b, ...rest].reduce((x,y) => self(x,y), a)
}