Last active
January 15, 2017 17:35
-
-
Save gaplo917/f687f1ad09988c32fa888179ce33d24a to your computer and use it in GitHub Desktop.
Kotlin Functional Support 2
This file contains hidden or 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
val list = listOf(1,2,3,4,5) | |
// destructing the list | |
val (a,b,c) = list | |
println("a = $a, b = $b, c = $c") | |
// a = 1, b = 2, c = 3 | |
// already include in kotlin std-lib | |
val head = list.head | |
val tail = list.tail | |
println(head) // 1 | |
println(tail) // [2,3,4,5] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment