Created
October 7, 2018 14:47
-
-
Save Nublo/b9f5da65aa41f13eb74aa5df1faef4a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun sum(xs: List<Int>): Int = when (xs.size) { | |
0 -> 0 | |
else -> xs.head + sum(xs.tail) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment