Reduction with &
should not widen the type
#14897
Labels
collections
Data structures holding multiple items, e.g. sets
design
Design of APIs or of the language itself
maths
Mathematical functions
This surprised me:
It makes sense of
+
to widen the type to prevent overflow, but&
cannot overflow. I tried to counteract the automatic widening by providing an explicit neutral element, but that didn't help.I also notice that a
+
reduction widensBool
toInt64
, while a&
reduction does not widen it.Should there be a
widereduce
in addition toreduce
?Should there be an optional argument
T
that lets people specify the return type?The text was updated successfully, but these errors were encountered: