Closed infinityfye closed 1 year ago
You're correct, thanks for catching that!
The parameter ordering mismatch is also echoed in the first example in Method Vs Standalone section. The current code is
[1,2,3,4,5]
.filter( isOdd )
.map( double )
.reduce( sum, 0 ); // 18
// vs.
reduce(
map(
filter( [1,2,3,4,5], isOdd ),
double
),
sum,
0
); // 18
I believe it should be
[1,2,3,4,5]
.filter( isOdd )
.map( double )
.reduce( sum, 0 ); // 18
// vs.
reduce(
sum,
0,
map(
double,
filter( isOdd, [1,2,3,4,5] )
)
); // 18
I realise that this is mostly to point out the difference in the API, which is why I didn't create a new Issue.
In the Map section of Chapter 9, after the implementation of
map
you give a note on parameter order, the example given has the parameters in the wrong order.I believe it should be
Please forgive me if I'm mistaken.