a curried function that consumes variable number of arguments, until all required parameters are available, after which a return value is spat out
const abcd = (a: number, b: string, c: boolean, d: symbol): string => (String(a) + b + String(c) + String(d))
const abcd_diversity_curry = curryMulti(abcd) // type: CurryMultiSignature<(a: number, b: string, c: boolean, d: symbol) => string, string, any>
console.log(
abcd_diversity_curry(
42, " hello to za warudo! "
) // type: CurryMultiSignature<(c: boolean, d: symbol) => string, string, any>
(true) // type: CurryMultiSignature<(d: symbol) => string, string, any>
(Symbol.iterator) // return type: string
) // logs `"42 hello to za warudo! true Symbol(Symbol.iterator)"`
Generated using TypeDoc
come here, come all! greet the Types' Olympics Champion of winter 2024. it took a while to correctly apply a multitude of gymnastics to get it functioning, but the dedication has paid off! please give
curryMulti
a round of applause! and don't forget that currying a diverse variety of types all at once brings strength!(said a nation right before its downfall)
now that introductions are over: curryMulti behaves very much like curry, the only difference being that you can bind an arbitrary number of arguments to the curried
fn
function, instead of just one (like in the case of curry)