List((1,2),(3,4)).map { case (a,b) => ... }
The case keyword invokes pattern matching / incompatibility logic.
Note the use of curly braces instead of paren after map
And slower, but shorter, to quickly rewrite your code:
case class EiulLimits(lower: Double, upper: Double) { def apply(x: Double) = List(x, lower, upper).sorted.apply(1) } def eiul(xs: Seq[(Int, Double)], limits: EiulLimits) = { xs.map { case (a,b) => (a, limits(b)) } }
Using:
scala> eiul(List((1, 1.), (3, 3.), (4, 4.), (9, 9.)), EiulLimits(3., 7.)) res7: Seq[(Int, Double)] = List((1,3.0), (3,3.0), (4,4.0), (7,7.0), (9,7.0))