summaryrefslogtreecommitdiffstats
path: root/Scala/funsets/src/main/scala
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-04-09 23:50:02 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-11-10 18:03:23 +0100
commit70a3a8927cd7e927ec96bc30f57377b32b080c09 (patch)
tree7b00edb2f78bf73669a9989a416beb7ecdb5e02b /Scala/funsets/src/main/scala
parent859af2fa66c152ab6fa2ddc4003ada65315aa5de (diff)
downloadcoursera-70a3a8927cd7e927ec96bc30f57377b32b080c09.zip
coursera-70a3a8927cd7e927ec96bc30f57377b32b080c09.tar.gz
Scala : week2: implement singletonSet, and union
Diffstat (limited to 'Scala/funsets/src/main/scala')
-rw-r--r--Scala/funsets/src/main/scala/funsets/FunSets.scala4
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 594a49d..c6d5ea5 100644
--- a/Scala/funsets/src/main/scala/funsets/FunSets.scala
+++ b/Scala/funsets/src/main/scala/funsets/FunSets.scala
@@ -20,13 +20,13 @@ object FunSets {
/**
* Returns the set of the one given element.
*/
- def singletonSet(elem: Int): Set = ???
+ def singletonSet(elem: Int): Set = (x => x == elem)
/**
* Returns the union of the two given sets,
* the sets of all elements that are in either `s` or `t`.
*/
- def union(s: Set, t: Set): Set = ???
+ def union(s: Set, t: Set): Set = (x => s(x) | t(x))
/**
* Returns the intersection of the two given sets,