Hacker News new | ask | show | jobs
by DangitBobby 1923 days ago
> Reduce can do all of the above, but must return a lower dimension result from its input.

What do you mean by this? You can accumulate just about anything into the resulting object, including a copy of the original array.

1 comments

I think it's just being confusingly stated. GP already said that reduce could implement map. I think it's merely that reduce can just output a single result, of any type. (Which is already more powerful than map, which must output an array.)

Of course, in fact you could hack anything in any of these, since you could be doing other work in the function called. But I think the general principle is sound.

> (Which is already more powerful than map, which must output an array.)

Don't tell Common Lisp.