Klitos Kyriacou
04/02/2025, 12:04 PMlistOf(1, 2, 3).sum()
listOf(1.toBigDecimal(), 2.toBigDecimal()).sum() // Error
listOf(1.toBigDecimal(), 2.toBigDecimal()).sumOf { it } // OK
Since there is already a sumOf
function specialized for BigDecimal
, why isn't there a sum
function for it too?hho
04/02/2025, 12:10 PMfun Iterable<BigDecimal>.sum() = this.sumOf { it }
gildor
04/04/2025, 9:40 AM