This function is taking list and one of two functions below and have to match every element in list.
val sqrt = (x: Double) => x * x val doubleValue = (x: Double) => 2 * x val yoman = (list: List[Double], func: Function[Double, Double]) => list match { case head :: tail => func(head) :: yoman(tail, func) case Nil => list } yoman(List(3.0, 4.0, 99.0), sqrt) yoman(List(-5.0, 1.0, 9.0), doubleValue) Now I have a problem with first case:
Error:(5, 39) recursive lazy value yoman needs type case head :: tail => func(head) :: yoman(tail, func) ^
yomana val containing a lambda instead of adef?