[kotlin] 함수 리터럴 (with receiver)
리시버가 있는 함수 리터럴 fun main() { println(100.lambdaSum(1)) println(100.functionSum(1)) } //lambda(function literal) with receiver val lambdaSum : Int.(Int) -> Int = { other -> plus(other) } //function(function literal) type with receiver val functionSum = fun Int.(it:Int) : Int = this + it //101 //101 위 코드는 리시버를 가지는 함수 타입입니다. 첫번째 함수는 lambdaSum의 타입은 Int.(Int) -> Int 로 사용할 수 있는 함수타입이며, other 를 인자로 받아서 ..
2021.06.17