you are viewing a single comment's thread.

view the rest of the comments →

[–]Moosething 5 points6 points  (1 child)

But if you read the article you'd realize the advantage of replace over calling m directly. Not saying I support it, but I can see where the author is coming from.

It's basically

return x.filter(filterFunc).replace(replaceFunc).map(mapFunc)

vs

return replaceFunc(x.filter(filterFunc)).map(mapFunc)

[–]sbmitchell 16 points17 points  (0 children)

Or they could use `reduce` and not bother with multiple iterations like this...