diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-04-10 00:10:04 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-10 18:03:23 +0100 |
commit | c09ffb13d5d3e2d13b336ffc455dd2b2307f7f37 (patch) | |
tree | cb232a88c25d29fa82c54d60e9a4b6c48a6af39b /Scala/funsets | |
parent | e2c8e84d0243f6b672f21c8b6281cbef61b8b760 (diff) | |
download | coursera-c09ffb13d5d3e2d13b336ffc455dd2b2307f7f37.zip coursera-c09ffb13d5d3e2d13b336ffc455dd2b2307f7f37.tar.gz |
Scala : week2: implement filter using intersect
Diffstat (limited to 'Scala/funsets')
-rw-r--r-- | Scala/funsets/src/main/scala/funsets/FunSets.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Scala/funsets/src/main/scala/funsets/FunSets.scala b/Scala/funsets/src/main/scala/funsets/FunSets.scala index 8b7778d..15a6bfc 100644 --- a/Scala/funsets/src/main/scala/funsets/FunSets.scala +++ b/Scala/funsets/src/main/scala/funsets/FunSets.scala @@ -43,7 +43,8 @@ object FunSets { /** * Returns the subset of `s` for which `p` holds. */ - def filter(s: Set, p: Int => Boolean): Set = (x => s(x) & p(x)) + //def filter(s: Set, p: Int => Boolean): Set = (x => s(x) & p(x)) + def filter(s: Set, p: Int => Boolean): Set = intersect(s, p) /** * The bounds for `forall` and `exists` are +/- 1000. |