As I am learning scal, I was wondering about optimisation when using local variables in lambda function.
For instance the following code :
val My_List = l.map{x =>
val a = coomplexFun(x.attr_1, x.attr_2 ) ;
(x.attr_1, doSomthing(a))
}
is it equivalent to :
val My_List = l.map{x =>
(x.attr_1, doSomthing(coomplexFun(x.attr_1, x.attr_2 )))
}
Or is there some extra memory allocation cost?