I know how to create instance of (String) -> Int lambda: {s: String -> s.length }, but how to create String.() -> Int lambda?
I know how to create instance of (String) -> Int lambda: {s: String -> s.length }, but how to create String.() -> Int lambda?
You have to declare the type explicitly to create a lambda with a receiver:
val x: String.() -> Int = { length }
More info: https://kotlinlang.org/docs/reference/lambdas.html#function-literals-with-receiver