Search                        Top                                  Index
COPYLIST                                 updated Mark Rubinstein  October 1985

    copylist(list) -> list;

This procedure takes as argument a list and returns a copy of it! For

    copylist([a b c]) =>
    ** [a b c]

COPYLIST could be defined as:

    define copylist(list);
        if null(list) then
            hd(list) :: copylist(tl(list))

COPYLIST might be used by a procedure which uses the UPDATER of HD and TL on
its arguments to produce its result but does not wish to alter the originally
given list (such as SORT).

NB the elements of the output list are not new copies, even if they are lists.
So if they are subsequently altered, this will affect the original list.

HELP * COPYTREE for a procedure which does a more complete copy.
HELP * COPYDATA for recursive copying of other data types

--- C.all/help/copylist
--- Copyright University of Sussex 1990. All rights reserved. ----------