[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Query about UNION
The Mary Poppins manual does not make clear whether UNION is permitted to
share structure with one of its arguments. For example, a possible
implementation technique (assuming for clarity that all keyword arguments
default) would be:
(defun union (list1 list2)
(dolist (item list2)
(unless (member item list1)
(push item list1)))
list1)
Is this permissible or impermissible? Near the top of page 202 the manual
says "returns a new list", and "new" may mean that every cons in the backbone
of the list is newly-created, or it might mean simply that the list is
the result of a computation.
A related query applies to the other three non-destructive set-construction
operations: if their result is to be EQUAL to one of their arguments, or some
nthcdr of one of their arguments, are they permitted to return the argument,
or the tail of it, or are they guaranteed always to return a freshly-constructed
list?