Kotlin list extension function
I have an extension function shown below
infix fun List.sumList(that: List) =
this.zip(that, Int::plus)
I am now trying to make this extension function generic so that it works on list of integers as well as float and double.
listOf(1,2,3).sumList(listOf(10,20,30)) gives me [11, 22, 33]
Below is my attempt of writing the same extension function using generics
inline infix fun List.sumListNew(that: T): List = when {
T is Double -> this.zip(that, Double::plus)
else ->...