Scala: Not a legal formal parameter when trying to call a function who has
a predicate as one of its argument
Here is the code that I'm trying to execute,
type Set = scala.collection.immutable.Set[Int]
defined type alias Set
def filter(s: Set, p: Int => Boolean): Set = Set(1,2,3)
filter: (s: Set, p: Int => Boolean)Set
filter(Set(1,2,3), (4 => 2 < 3))
error: not a legal formal parameter filter(Set(3,4), (4 => 2<3))
What am I doing wrong? Please help.
No comments:
Post a Comment