summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-04-10 00:10:04 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-11-10 18:03:23 +0100
commitc09ffb13d5d3e2d13b336ffc455dd2b2307f7f37 (patch)
treecb232a88c25d29fa82c54d60e9a4b6c48a6af39b
parente2c8e84d0243f6b672f21c8b6281cbef61b8b760 (diff)
downloadcoursera-c09ffb13d5d3e2d13b336ffc455dd2b2307f7f37.zip
coursera-c09ffb13d5d3e2d13b336ffc455dd2b2307f7f37.tar.gz
Scala : week2: implement filter using intersect
-rw-r--r--Scala/funsets/src/main/scala/funsets/FunSets.scala3
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.