https://kotlinlang.org logo
#functional
Title
# functional
i

imashnake_

07/09/2022, 8:22 AM
Does anyone know if lambdas can have extension functions? By the looks of it I assume not but I'm not sure why they shouldn't.
r

rtsketo

07/09/2022, 10:22 AM
Copy code
val giefString: () -> String = { "a lambda" }

fun (() -> String).pew() = 
    println("I have ${ invoke() } as a receiver :o")
    
fun main() { giefString.pew() }
❤️ 5
i

imashnake_

07/09/2022, 10:29 AM
Nice! I was apparently using the syntax wrong. Thanks!
w

wakingrufus

07/09/2022, 7:49 PM
Cool
4 Views