`S` is the type of the accumulator (and therefore ...
# getting-started
h
S
is the type of the accumulator (and therefore also the return type).
a
Yeah T is the type passed as the Type in the List but we aren't passing S anywhere
b
With
reduce
the accumulator type is determined by the first element of the list being processed. I’ve linked an example: https://pl.kotl.in/HyrqmCweN
h
You're passing
S
as the type of the first argument in the lambda. This can be any supertype of the collections element type: https://pl.kotl.in/rk0XOTwx4
👏 1
👆 1
👍 1
a
Thanks a lot:)
I didn't provide any type to the accumulator as the compiler automatically inferred it, that threw me off, now I get it 😅