Next: List Selection, Previous: List Predicates, Up: Lists
This section describes the procedures for constructing new lists.
list simply returns a list where the elements are the arguments,
cons* is similar, but the last argument is stored in the cdr of
the last pair of the list.
Return a list containing objs, the arguments to
list.
Return a list containing objs, the arguments to
list.
Like
list, but the last arg provides the tail of the constructed list, returning (cons ARG1 (cons ARG2 (cons ... ARGn))). At least one argument must be given, in which case that argument is returned. This is calledlist*in some other Schemes and in Common Lisp.
Return a (newly-created) copy of lst. If lst is not
cons?, simply return it. (This is for builtin compatibility with SRFI 1.)
Return a new list of n elements, where each element is initialized to init. init defaults to the empty list
()if not given.
Note that list-copy only makes a copy of the pairs which make up
the spine of the lists. The list elements are not copied, which means
that modifying the elements of the new list also modifies the elements
of the old list. On the other hand, applying procedures like
set-cdr! or delv! to the new list will not alter the old
list. If you also need to copy the list elements (making a deep copy),
use the procedure copy-tree (see Copying).