Attempting to compile the function below in scala 2.11.0
def dafuq(canvas: Array[Array[Boolean]]): Array[Array[Boolean]] = {
for (r <- canvas.reverse) yield r.zipWithIndex.map((c: Boolean, i: Int) => c)
}
yields
Solution.scala:6: error: type mismatch;
found : (Boolean, Int) => Boolean
required: ((Boolean, Int)) => ?
for (r <- canvas.reverse) yield r.zipWithIndex.map((c: Boolean, i: Int) => c)
^
The function is bogus but it illustrates a problem that I have encountered. I'm quite new to Scala so this could be a rookies mistake but I cannot find any solution or explanation to this problem. Do you know what causes the above behaviour?
Also is return type hinting possible for lambda expressions?