Reputation: 93
I have a function that look like:
def functionTrans(f: FunctionDec) = {
// some FunctionDec manipulation
f.name -> FuncEntry(/* something here*/)
}
Witch basically do a manipulation of FunctionDec and turn into a Pair (String, FuncEntry). Also i have a Map[String, FuncEntry] called varsEnv and a List[FunctionDec] called decs. I need apply that manipulation to all the list and return an augmented Map. What i did looks like:
val venvWithFunction = decs.foldLeft(varsEnv)(_ + functionTrans(_))
There's a better scala-colection way to do this?
Upvotes: 0
Views: 67