I send an arithmetic operation like: a + b to my program, inside the program I read every part and set the param variable, x is another constant variable that I have and the operator. The operator will be passed to args (1), and then based on what I have, I want to perform an action using another program. Below is the part of the program that I explained:
if (param != 0){ args(1) match { case + =>val resRDD=sv.apply(sRDD, x:Float=>x + param) case - =>val resRDD = sv.apply(sRDD, x:Float=>x - param) case * =>val resRDD = sv.apply(sRDD, x:Float=>x * param) case / =>val resRDD = sv.apply(sRDD, x:Float=>x / param) case _ => "error" } }
And I get the following error:
[error] ')' expected but identifier found. [error] case * =>val resRDD = sv.apply(sRDD, x:Float=>x * param) [error] ^
And when I comment on this line, I get a whole bunch of errors, similar to the following for all statements:
[error] case + =>val resRDD=sv.apply(sRDD, x:Float=>x + param) [error] ^ [error] case + =>val resRDD=sv.apply(sRDD, x:Float=>x + param) [error] ^
If i use
case "+" =>
I will get the following error:
[error] not fount: type +
I am not mistaken in my program!
Thanks!
source share