Lukasz Kalnik
10/17/2024, 8:37 AMfun <S, T : S> Iterable<T>.reduce(operation: (acc: S, T) -> S): S
have two generic type parameters (S
and T
) when it operates on the same collection? In its source code acc
is taken from the Iterable<T>
so S
is always the same type as T
anyway.Lukasz Kalnik
10/17/2024, 8:40 AMT : S
, so S
can be a supertype of T
.