#
Union-set for sets represented as unordered lists
^{
}

Implement the
`union-set`

operation for the unordered-list representation of sets.

#####
#
Anton Burenkov
1 year ago

#
Anton Burenkov

1 year ago

Thanks. This solution passes all tests except the last one.

`(check-equal? (union-set '() second) second)`

which is an edge case - the first element of the list is empty and the second element is expected as a result.

In this case, it is logical to return the second element unchanged, but there is clearly no such condition. This test has been replaced by a more general one.

The order shouldn't matter when validating the solution. E.g. below code should be correct but doesn't pass the test

The function

`adjoin-set`

is defined in book.