Derek Peirce
05/22/2020, 7:15 PMIntRange.forEach uses Iterable.forEach, so (1..n).forEach { ... } creates an Iterator, while for (k in (1..n)) { ... } is optimized to use a while-loop, not even creating the original IntRange object. Could IntRange receive its own forEach extension method to preserve this optimization, and perhaps receive additional optimizations for common methods like map?Ruckus
05/22/2020, 7:40 PMilya.gorbunov
05/22/2020, 8:36 PMDerek Peirce
05/22/2020, 10:12 PMIterable extension function.