See how to define and use functional datastructures (lists in this case) in Kotlin, how the process is different from Scala, and how to avoid pitfalls.
https://dzone.com/articles/kata-implementing-a-functional-list-data-structure
* Functional Programming in Scala
* here
* "when" expression in Kotlin
* Kotlin documentation
* GitHub repo