added assignment 3 ex 3.2
This commit is contained in:
		| @@ -5,6 +5,8 @@ abstract class IntSet() { | ||||
|   def union(other: IntSet): IntSet | ||||
|   def intersect(other: IntSet): IntSet | ||||
|   def excl(x: Int): IntSet | ||||
|   def +(x: Int): IntSet = this.add(x) | ||||
|   def -(x: Int): IntSet = this.excl(x) | ||||
| } | ||||
|  | ||||
| class NonEmpty(elem: Int, left: IntSet, right: IntSet) extends IntSet() { | ||||
| @@ -82,3 +84,7 @@ s2.excl(0) | ||||
| s2.excl(6) | ||||
| s2.excl(2) | ||||
| s2.excl(4) | ||||
|  | ||||
| val o1 = Empty + 3 + 4 + 12 + 5 | ||||
| val o2 = (o1 - 3 - 4) | ||||
| o2  // ((-|5|-)|12|-) | ||||
		Reference in New Issue
	
	Block a user