I have a function that removes one list `y` from list `x`. The precondition is that the occurrence list `y` is a subset of `x` - any character appearing in `y` must appear in `x`, and its frequency in `y` must be <= its frequency in `x`.

The resulting value is an occurrence - meaning it is sorted and has no zero-entries.

This is my original code. This was for the Scala progfun assignment, now I'm just curious as to what the right answer was.

```
type Occurrences = List[(Char, Int)]

def subtract(x: Occurrences, y: Occurrences): Occurrences = x filterNot (y contains)

```

It has to pass the following unit tests.

Test 1

```
 test("subtract: lard - r") {
    val lard = List(('a', 1), ('d', 1), ('l', 1), ('r', 1))
    val r = List(('r', 1))
    val lad = List(('a', 1), ('d', 1), ('l', 1))
    assert(subtract(lard, r) === lad)
  }

```

Test 2

```
// subtract: jimmy - my
List((i,1), (j,1), (m,1), (y,0)) did not equal List((i,1), (j,1), (m,1))

```

Test 3

```
//subtract: ok - ok
List((k,0), (o,0)) did not equal List()

```

Test 4

```
//subtract: abba - abba
List((a,0), (b,0)) did not equal List()

```

Test 5

```
//subtract: assessment - assess

```