Re:Click
by jolux on Friday March 19, 2021 @11:20PM
(#26520563)
forEach is actually more powerful than map, you would not be able to use map for side effects in a static and/or lazy language. In a strict, dynamic language, it matters less. Even so I wouldn't describe being an expression vs statement as a difference in power. It's contextual.
[ Parent
| on HN ]
Re:Click
by thaumasiotes on Saturday March 20, 2021 @01:55AM
(#26521080)
> forEach is actually more powerful than map, you would not be able to use map for side effects in a static and/or lazy language.
You might notice this problem above, where it's necessary to do
for n in map(reductor, iterable): pass
to realize the mapping.