mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 15:53:40 +00:00
10 lines
237 B
Kotlin
Vendored
10 lines
237 B
Kotlin
Vendored
class List<T>(val head: T, val tail: List<T>? = null)
|
|
|
|
fun <T> List<T>.mapHead(f: (T)-> T): List<T> = List<T>(f(head), null)
|
|
|
|
fun box() : String {
|
|
val a: Int = List<Int>(1).mapHead{it * 2}.head
|
|
System.out?.println(a)
|
|
return "OK"
|
|
}
|