Mark Lewis
Dec 16, 2021

--

Interesting take. Other than the () vs. {} aspect, it seems to me that every functional language will allow most of these differences because this is really just currying. I guess the underscore syntax is also a difference, but Kotlin has that type of short syntax and I’m guessing others do as well. Functional languages also generally have multiple folds/reduces. Indeed, Kotlin has fold, foldRight, foldIndexed, and foldRightIndexed. Kotlin lacks built-in currying, but I’m not convinced that is a strength of the language, even for the novice.

Of course, this can also be done with a for-loop, a while-loop, a for-each loop, a do-while loop, recursively, …

My guess is that I can write this in almost as many ways in Kotlin as in Scala, but you left Kotlin on your list. Why do you see Kotlin as being different in this situation?

--

--

Mark Lewis
Mark Lewis

Written by Mark Lewis

Computer Science Professor, Planetary Rings Simulator, Scala Zealot

Responses (1)