Seri
04/10/2019, 7:03 PMShawn
04/10/2019, 7:15 PMSeri
04/10/2019, 7:18 PMShawn
04/10/2019, 7:22 PMShawn
04/10/2019, 7:22 PM.fold { ... }
might actually work in this situationShawn
04/10/2019, 7:23 PMfun a(i: Int): Int = i + 1
fun b(i: Int): Int = i * 2
fun c(i: Int): Int = i + 3
fun test() {
val start = 1
val fns = listOf(::a, ::b, ::c)
val final = fns.fold(start) { acc, consumer -> consumer(acc) }
}
Seri
04/10/2019, 7:25 PMSeri
04/10/2019, 7:25 PMfold
, but it didn’t occur to me to use a lambda like that