From c09ffb13d5d3e2d13b336ffc455dd2b2307f7f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 10 Apr 2013 00:10:04 +0200 Subject: Scala : week2: implement filter using intersect --- Scala/funsets/src/main/scala/funsets/FunSets.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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. -- cgit v1.1-2-g2b99