https://kotlinlang.org logo
#announcements
Title
# announcements
s

sdavids

02/09/2017, 5:44 AM
Now, I could do something like:
constructor(vararg cells: Cell, f: (List<T>) -> T)
but then the lambdas would go from
{ x, y -> x + y }
to something like
{ it[0] + it[1] }
which I guess would be ok, but not the most readable.
m

mfulton26

02/09/2017, 3:06 PM
sdavids: In Kotlin 1.1 you can use destructuring in lambdas so that with
constructor(vararg cells: Cell, f: (List<T>) -> T)
you can write
{ (x, y) -> x + y}
. One caveat to this is that it will be up to the call-point to destructure the right number of params.
4 Views