holgerbrandl
01/09/2021, 8:38 PMrepeat
that allows to assign the result: val created = repeat(n){ create_something()}
? Doing (1..n).map{ create_something() }
does not feel elegant.
I can certainly create it myself with fun <T> repeat(n:Int, builder: (Int) -> T) = (1..n).map{ builder(it)}
but I wonder why it's not part of stdlib? It also does not really work well, because somehow it's not resolved when being placed in some other source file that is different from that which contains the call site.Milan Hruban
01/09/2021, 9:11 PMval numbers = List(10) { it * 2 }
that's nice enough for meephemient
01/09/2021, 10:00 PMsomehow it's not resolved when being placed in some other source fileare they in the same package? otherwise it needs to be imported
holgerbrandl
01/09/2021, 11:07 PMholgerbrandl
01/09/2021, 11:08 PMholgerbrandl
01/09/2021, 11:10 PMlouiscad
01/12/2021, 10:03 AM