zucen.co
06/10/2018, 7:00 AM// this is what i kind of need
fun justFunction(i:Int?=1): Int {
return 3
}
val b= justFunction(3)
val a = justFunction()
// but i wat to be able do define this behaviour by labdas
val singleParamFun: (i:Int?=1) -> Unit = ..
val aa = singleParamFun()
val bb = singleParamFun(2)
what does not compile for [Unsupported [default value of parameter in function type]]
how would you appreach this when you want interface for functions wher eyou want to use defaults?Hamza
06/10/2018, 7:01 AMHullaballoonatic
06/12/2018, 12:16 PMdalexander
06/12/2018, 12:30 PMHullaballoonatic
06/12/2018, 12:56 PMHullaballoonatic
06/12/2018, 12:57 PMdalexander
06/12/2018, 1:03 PMInt
and Double
or whatever. When doing math I frequently want a .i
extension val which is a "cast-to-int" call. Usable like someByte.i
, which keeps the casting from being too distracting in a bunch of mathematically oriented code.Hullaballoonatic
06/12/2018, 1:22 PMli = listOf(a, b) + 1000 * c
Hullaballoonatic
06/12/2018, 1:22 PMHullaballoonatic
06/12/2018, 4:07 PMHullaballoonatic
06/12/2018, 7:49 PMShawn
06/12/2018, 7:51 PMList
objects, Array
is an unoptimized wrapper around java arraysHullaballoonatic
06/12/2018, 7:52 PMHullaballoonatic
06/12/2018, 7:52 PMShawn
06/12/2018, 7:53 PMShawn
06/12/2018, 7:53 PMList
with mutating functions, ArrayList
is a class that implements MutableList
Hullaballoonatic
06/12/2018, 7:53 PMShawn
06/12/2018, 7:54 PMmutableListOf()
yields ArrayListsHullaballoonatic
06/12/2018, 7:54 PMShawn
06/12/2018, 7:54 PMHullaballoonatic
06/12/2018, 7:54 PMShawn
06/12/2018, 7:55 PMShawn
06/12/2018, 7:56 PMArrayList
implements MutableList
which extends List
Hullaballoonatic
06/12/2018, 7:57 PMShawn
06/12/2018, 7:57 PMmutableListOf()
is finediesieben07
06/12/2018, 7:57 PMShawn
06/12/2018, 7:57 PMList
backed by an arrayHullaballoonatic
06/12/2018, 7:58 PMHullaballoonatic
06/12/2018, 7:59 PMHullaballoonatic
06/12/2018, 8:00 PM