marstran
04/04/2018, 2:54 PMkarelpeeters
04/04/2018, 2:55 PMholgerbrandl
04/04/2018, 3:01 PMAregev2
04/04/2018, 5:19 PMAregev2
04/04/2018, 5:21 PMAregev2
04/04/2018, 5:22 PMkarelpeeters
04/04/2018, 5:29 PMAregev2
04/04/2018, 5:41 PMuser
04/04/2018, 6:28 PMhttps://kotlinlang.slack.com/files/U9HPANSRE/FA10HM0J0/image.png▾
karelpeeters
04/04/2018, 6:31 PMMap(list) { f(it) } == list.map { it to f(it) }.toMap()
.ilya.gorbunov
04/04/2018, 6:32 PMlist.associateBy({ it }, { f(it) })
karelpeeters
04/04/2018, 6:33 PMkarelpeeters
04/04/2018, 6:34 PM(0 until size).map { f(it) }
for List(size) { it }
, but it doesn't matter much.ilya.gorbunov
04/04/2018, 6:35 PMList(size) { }
you get a list of that size, when you use hypothetical Map(size) { }
I'm unsure what should you get.ilya.gorbunov
04/04/2018, 10:48 PMThreadsDid you know about
thread { }
function? http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.concurrent/thread.html
Pointers (as mentioned in #kotlin-native)What kind of pointers? Every instance of reference type is a pointer of some kind. Could you point to the discussion where it was mentioned?
we can use Pair() or A to B similar to mapOf()take a look at
associate
function: (0 until size).associate { it to f(it) }
user
04/05/2018, 1:16 AMhttps://kotlinlang.slack.com/files/U9HPANSRE/FA10HM0J0/image.png▾
elect
04/16/2018, 8:30 AMpredicate
? This is true for an empty list, ergo, checking if the list is empty is up to the userkarelpeeters
04/16/2018, 8:31 AMelect
04/20/2018, 7:36 AMelect
04/20/2018, 7:36 AMforEach
and onEach
pass it as argumentelect
04/20/2018, 7:36 AMatEach
?elect
04/20/2018, 7:38 AMinline fun <T> Iterable<T>.atEach(action: T.() -> Unit): Unit {
for (element in this) element.action()
}
elect
04/20/2018, 7:39 AMelect
04/20/2018, 7:40 AMinline fun <T, C : Iterable<T>> C.atEach(action: T.() -> Unit): C {
return apply { for (element in this) element.action() }
}
marstran
04/20/2018, 7:41 AMonEach(action)
I think 😛elect
04/20/2018, 7:41 AMelect
04/20/2018, 7:41 AMmarstran
04/20/2018, 7:42 AMinline fun <T, C : Iterable<T>> C.atEach(action: T.() -> Unit): C = onEach(action)
gildor
04/20/2018, 7:42 AMonEach { it.apply {
doSomething()
} }
elect
04/20/2018, 7:42 AM