Brian Dilley
10/21/2020, 3:44 AMMostafa Hadian
10/21/2020, 12:27 PMSourabh Rawat
10/22/2020, 6:13 PMvar toPlayer = players.random()
while (toPlayer == fromPlayer) {
toPlayer = players.random()
}
I am not liking the multiple assignments + var here...Irving Rivas
10/23/2020, 2:47 PMpoohbar
10/24/2020, 9:53 PMAlec Muffett
10/25/2020, 3:48 PMthis
in the buildString
lambda does not refer back to the ByteArray
, but instead to the implicit StringBuilder
which is being built, and I suspect that the forEach
is inheriting its iterator from the inner this
, rather than the (shadowed) outer this
.
HOWEVER: the code is cute, and I would like understand the problem to be certain, and to save the situation. Can I elegantly fix the shadowing problem in the existing code, rather than refactoring it to use a loop, or with
or apply
?
const val INT_TO_HEX = "0123456789ABCDEF"
fun ByteArray.toHexStringDoesNotWork() = buildString {
forEach {
val octet = it.toInt()
append(INT_TO_HEX[octet.and(MASK_UPPER_NIBBLE).ushr(4)])
append(INT_TO_HEX[octet.and(MASK_LOWER_NIBBLE)])
}
}
poohbar
10/25/2020, 4:50 PMlists.chunked(size / n)
cognio
10/27/2020, 3:55 PMuser["username"]
Pymous Thomas
10/27/2020, 4:28 PMspeed_star
10/29/2020, 3:27 AMRobert
10/29/2020, 8:35 PMRobert
10/29/2020, 10:29 PMval myByte: Byte = 0;
val myInt: Int = 0;
myByte == myInt;
but CAN i actually do this?
myByte.compareTo(myInt) == 0;
Isn’t it the same?UnAn
10/29/2020, 11:32 PMJuan B
10/30/2020, 4:51 AMAlec Muffett
10/30/2020, 7:12 AMSequenceInputStream()
takes a Java Enumeration
as an argument, but at the moment I only have a `List<InputStream>`; there's a workaround for this described at https://www.pushing-pixels.org/2018/08/15/converting-list-to-enumeration-in-kotlin.html to provide a List<T>.toEnumeration()
method, but I am wondering if there's something more elegant?Ananiya
10/30/2020, 10:40 AMSlackbot
10/30/2020, 5:21 PMHimansh Singh
10/31/2020, 2:30 AMzero_coding
11/01/2020, 11:00 AMSteven Wang
11/01/2020, 11:40 PMKenneth
11/04/2020, 3:47 PModay
11/06/2020, 10:59 AMin
cause the runtime of the program to become as if it were 2 for loops O(n2)?Sean
11/06/2020, 7:20 PMDraget
11/06/2020, 9:28 PMtenprint
11/09/2020, 4:34 PMxiaobailong24
11/10/2020, 4:58 AMcorneil
11/10/2020, 9:55 AMKenneth
11/10/2020, 11:35 AMAyden
11/13/2020, 12:29 AMDraget
11/13/2020, 8:52 PMkotlin("jvm")
Is this 'merely' a short hand form for id("org.jetbrains.kotlin.jvm" version "1.4.10"
or does it do anything else?Draget
11/13/2020, 8:52 PMkotlin("jvm")
Is this 'merely' a short hand form for id("org.jetbrains.kotlin.jvm" version "1.4.10"
or does it do anything else?Saharath Kleips
11/13/2020, 9:02 PMkotlin("jvm") version "1.4.10"
And renovate picks it up fine. Would this work for you?jbnizet
11/13/2020, 11:19 PMDraget
11/13/2020, 11:27 PM