vlastachu
05/23/2017, 1:48 PMfun <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"
cy
05/23/2017, 2:22 PM::testfun1.optionalApply(null)
::
vlastachu
05/23/2017, 2:25 PM