menegatti
07/20/2017, 11:08 AMdata class <T> MyClass(...)
should workdio
07/20/2017, 4:35 PMfun foo(x: Int): Int
fun bar(x: Int): Int
fun baz(x: Int): Int
I could baz(bar(foo(5)))
but that starts to feel nested and gross, in clojure I can say (-> 5 foo bar baz)
to feed the results of one function call into the next and un-nest my calls, I'm wondering if there's some equivalent ?dio
07/20/2017, 4:47 PMtechie01
07/21/2017, 7:08 AMmohita
07/21/2017, 9:27 AMmarior
07/21/2017, 9:34 AMdanielsan
07/21/2017, 4:30 PMmat
07/22/2017, 1:09 PMivano
07/23/2017, 5:35 PMrobsonj
07/23/2017, 10:09 PMjkbbwr
07/23/2017, 11:10 PMdanneu
07/23/2017, 11:36 PMwhen (v) { > 60 -> true }
?pike
07/24/2017, 2:44 AMtechie01
07/24/2017, 6:43 AMtechie01
07/24/2017, 9:37 AMdamian
07/24/2017, 7:32 PMget
operator is operator fun get(key: K): V?
, where null
is returned if the key is not found.karelpeeters
07/24/2017, 7:37 PMfun main(args: Array<String>) {
val map = mutableMapOf<String, Int>()
val lst = mutableListOf<Int>()
map["answer"] = 42
for (arg in args) {
map[arg]?.let {
lst.add(it)
}
}
}
rrmen
07/25/2017, 6:04 AMtechie01
07/25/2017, 6:11 AMdalexander
07/25/2017, 1:09 PMval sb: StringBuilder = ...
you could call sb.configure()
.techie01
07/25/2017, 3:51 PMthisen
07/27/2017, 8:33 PM!!
operator do?danneu
07/28/2017, 1:31 AMfun foo (_a a: Int) { return _a + _a }
and thus foo(a = 42)
where you can name an argument differently for the callsitekarelpeeters
07/28/2017, 9:34 AMtechie01
07/28/2017, 10:48 AMhorse_badorties
07/30/2017, 8:22 AMArray
in the first place? Why not use Collection
and let the compiler optimize them away as JVM Arrays where possible?ziad
07/30/2017, 11:21 AModay
08/01/2017, 10:43 AModay
08/01/2017, 7:41 PMHandler().postDelayed(
{ Timber.d("Testing") }, 100)
rockerhieu
08/02/2017, 4:05 AMsrcList.subList(from, to).mapTo(destList) { convert(it) }
subList
may throw IndexOutOfBound, doesn't it?rockerhieu
08/02/2017, 4:05 AMsrcList.subList(from, to).mapTo(destList) { convert(it) }
subList
may throw IndexOutOfBound, doesn't it?diesieben07
08/02/2017, 7:19 AMto
and from
to be constrained to the list's size automatically if they are too large?rockerhieu
08/02/2017, 7:30 AMdiesieben07
08/02/2017, 7:30 AMrockerhieu
08/02/2017, 7:30 AMdiesieben07
08/02/2017, 7:31 AMrockerhieu
08/02/2017, 7:31 AMfrom
, minimize to
diesieben07
08/02/2017, 7:31 AMfrom
is out of bounds? 😄rockerhieu
08/02/2017, 7:32 AMsrcList.take(count)
diesieben07
08/02/2017, 7:32 AMtake
never throws 😉rockerhieu
08/02/2017, 7:32 AM