nickk
08/29/2018, 1:26 PMIterable.reduce
, why is T
constrained to be a subtype of S
?
As long as operation
produces the correct type, what is the problem?
public inline fun <S, T : S> Iterable<T>.reduce(operation: (acc: S, T) -> S): S
diesieben07
08/29/2018, 1:27 PMacc
is the first element, so the elements of the Iterable need to fit into S
.spand
08/29/2018, 1:28 PMfold