I am trying to create a list of lambdas in Kotlin, but am getting the following compile-time error:
Destructuring declaration initializer of type Int must have a 'component1()' function
Here is my code:
val pathXRanges = listOf<(Int) -> List<Int>>(
{(extX) -> ((extX - (board.k - 1))..(extX + board.k - 1)).toList()}, // diagonal 1 (y = -x)
{(extX) -> ((extX - (board.k - 1))..(extX + board.k - 1)).toList()}, // diagonal 2 (y = x)
{(extX) -> List(board.k * 2 - 2) { extX } }, // x = x
{(extX) -> ((extX - (board.k - 1))..(extX + board.k - 1)).toList()} // y = y
)
That's pretty much it! Any help is appreciated, let me know if you need clarification on anything.
Thanks!