Hello, I tried write helper function for applicati...
# announcements
v
Hello, I tried write helper function for application 1 or more optional args on function:
Copy code
fun <A, B> ((A)->B).optionalApply(optional: A?): B? {
    return optional?.let(this) // "let" good for 1 arg 
}
// test
fun testfun1(i: Int) = i + 1
testfun1.optionalApply(null) // "Function invocation expected" on "testfun1"
c
vlastachu: should be
::testfun1.optionalApply(null)
extension functions on functional types are supported
you just need a function reference
::
v
Oh... thanks. used it only in context of methods