When I run the below scala program in cloudera quickstart , I getting small error which I unable to rectify it. I am starter for scala programming.
object sort {
def sort(s:Array[Int] => Unit ){
var a=new Array[Int](3);
a(0)=1;
a(1)=1;
a(2)=1;
s(a);
}
def qsort(a:Int*){
println("qsort printed");
}
def main(args:Array[String]){
sort(qsort);
}
}
I am getting error
[cloudera@quickstart scalap]$ scalac sort.scala
sort.scala:12: error: type mismatch;
found : Seq[Int] => Unit
required: Array[Int] => Unit
sort(qsort);
^
one error found
Please show me the solution.
sort(qsort(_:_*))would do the trick.