Argument type of anonymous function
问题 I'm having some trouble with this code. It's supposed to be an OperationTree with Elements BinaryOperations and UnaryOperations. The method eval does the evaluation and looks up the variables in a map. Here's the code 1 import collection.immutable.HashMap 2 sealed abstract class OpTree[T]{ 3 4 def eval(v:HashMap[Char,T]):T = { 5 case Elem(x) => x 6 case UnOp(f,c) => { 7 f(c.eval(v)) 8 } 9 case BinOp(f,l,r) => { 10 f(l.eval(v),r.eval(v)) 11 } 12 case Var(c) => { 13 v.get(c) 14 } 15 } 16 } 17 /