Объединение множеств представленных неупорядоченными списками
Реализуйте операцию
union-set
для представления множеств в виде неупорядоченных списков.
#
Anton Burenkov
1 год назад
#
Anton Burenkov
1 год назад
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.