Re:Anecdotally, Programmers Dislike "Reduce"
by ingonealan3 on Thursday September 17, 2026 @12:54AM
(#49736554)
Why? It does, after all, reduce a collection to a single value.
[ Parent
| on HN ]
Re:Anecdotally, Programmers Dislike "Reduce"
by ketzu on Thursday September 17, 2026 @03:05AM
(#49737388)
The resulting value can be anything you want. You can turn a list into a tree, or another list.
Bad example:
reduce(lambda x,y: x+x.extend([y+2,y*2,y**2]), [1,2,3,4], [])
Reduces the list to another list three times as long.It's a reduction in the sense of a transformation (also often seen in complexity theory), not in the "this makes this smaller" everyday usage that I think about first.
Re:Anecdotally, Programmers Dislike "Reduce"
by karmakurtisaani on Thursday September 17, 2026 @02:09AM
(#49736986)
I suppose it's just so ... reductive, you know?