concept lambda in category kotlin
appears as: lambda, lambdas

This is an excerpt from Manning's book The Joy of Kotlin.
When the lambda is the last argument of a function, it can be put outside of the parentheses:
fun triple(list: List<Int>): List<Int> = list.map { a -> a * 3 } fun product(list: List<Int>): Int = list.fold(1) { a, b -> a * b }In the
mapexample, the lambda is not only the last argument, but the only one, so the parentheses can be removed. As you may have noticed in the second example, the arguments of the lambda don’t need to be put between parentheses. In fact, you can’t put parentheses around them because it would change the meaning. This would not compile: