So, I have a simple collection, say:
val a = List(1, 2, 3, 4)
I want to map it to a list of tuples, and then filter over that, and then later map over the result of it, so it would be something like:
a.map(x => (x, x * x)).filter(tup => tup._2 < 10).map(tup => tup._1 + tup._2)
Except instead of using tup
and tup._1
, I want to use variable names like number
and square
, preferably in the arguments section.
Is it possible? How can I achieve that?