KT-707 default params for constructors
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class List<T>(val head: T, val tail: List<T>? = null)
|
||||
|
||||
fun <T> List<T>.mapHead(f: fun(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"
|
||||
}
|
||||
Reference in New Issue
Block a user