← Back to context Comment by ingonealan3 5 hours ago Why? It does, after all, reduce a collection to a single value. 3 comments ingonealan3 Reply ketzu 3 hours ago 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. karmakurtisaani 4 hours ago I suppose it's just so ... reductive, you know?
ketzu 3 hours ago 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.
The resulting value can be anything you want. You can turn a list into a tree, or another list.
Bad example:
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.
I suppose it's just so ... reductive, you know?