diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-04-10 00:03:54 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-10 18:03:23 +0100 |
commit | c5f1113df8159078ac3bfb6fbe8426db72248512 (patch) | |
tree | fe01a593b5906d493e9e490fa29d19471fe862e0 /Scala/funsets/src/main/scala | |
parent | 70a3a8927cd7e927ec96bc30f57377b32b080c09 (diff) | |
download | coursera-c5f1113df8159078ac3bfb6fbe8426db72248512.zip coursera-c5f1113df8159078ac3bfb6fbe8426db72248512.tar.gz |
Scala : week2: implement intersect and diff
Diffstat (limited to 'Scala/funsets/src/main/scala')
-rw-r--r-- | Scala/funsets/src/main/scala/funsets/FunSets.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Scala/funsets/src/main/scala/funsets/FunSets.scala b/Scala/funsets/src/main/scala/funsets/FunSets.scala index c6d5ea5..1fd2d31 100644 --- a/Scala/funsets/src/main/scala/funsets/FunSets.scala +++ b/Scala/funsets/src/main/scala/funsets/FunSets.scala @@ -32,13 +32,13 @@ object FunSets { * Returns the intersection of the two given sets, * the set of all elements that are both in `s` and `t`. */ - def intersect(s: Set, t: Set): Set = ??? + def intersect(s: Set, t: Set): Set = (x => s(x) & t(x)) /** * Returns the difference of the two given sets, * the set of all elements of `s` that are not in `t`. */ - def diff(s: Set, t: Set): Set = ??? + def diff(s: Set, t: Set): Set = (x => s(x) & !t(x)) /** * Returns the subset of `s` for which `p` holds. |