| ▲ | titzer 7 hours ago | ||||||||||||||||
I agree with this article. Tuples nicely unified multiple return values and multiple parameters. FWIW Scala and Virgil both support the _ syntax for the placeholder in a partial application.
Or more simply, reusing some built-in functions: | |||||||||||||||||
| ▲ | ackfoobar 3 hours ago | parent [-] | ||||||||||||||||
As noted in the article: > This feature does have some limitations, for instance when we have multiple nested function calls, but in those cases an explicit lambda expression is always still possible. I've also complained about that a while ago https://news.ycombinator.com/item?id=35707689 --- The solution is to delimit the level of expression the underscore (or dollar sign suggested in the article) belongs to. In Kotlin they use braces and `it`.
Then modifying the "hole in the expression" is easy. Suppose we want to subtract the first argument by 2 before passing that to `add`: | |||||||||||||||||
| |||||||||||||||||