[a,b].reduce(f,x) code to [a,b].reduce(f) using transducer /CPS based functional references?
- 阅读更多 关于 [a,b].reduce(f,x) code to [a,b].reduce(f) using transducer /CPS based functional references?
In my previous Quesion: Extracting data from a function chain without arrays @Aadit M Shah gave me astonishing solution as follows: https://stackoverflow.com/a/51420884/6440264 Given an expression like A(a)(b)(f) where f is a function, it's impossible to know whether f is supposed to be added to the list or whether it's the reducing function. Hence, I'm going to describe how to write expressions like A(a)(b)(f, x) which is equivalent to [a, b].reduce(f, x) . This allows us to distinguish when the list ends depending upon how many arguments you provide: const L = g => function (x, a) { switch