DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(guile.info.gz) List Constructors

Info Catalog (guile.info.gz) List Predicates (guile.info.gz) Lists (guile.info.gz) List Selection
 
 22.2.3 List Constructors
 ------------------------
 
 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.
 
  -- Scheme Procedure: list . objs
  -- C Function: scm_list (objs)
      Return a list containing OBJS, the arguments to `list'.
 
  -- Scheme Procedure: cons* arg1 arg2 ...
  -- C Function: scm_cons_star (arg1, rest)
      Like `list', but the last arg provides the tail of the constructed
      list, returning `(cons ARG1 (cons ARG2 (cons ... ARGN)))'.
      Requires at least one argument.  If given one argument, that
      argument is returned as result.  This function is called `list*'
      in some other Schemes and in Common LISP.
 
  -- Scheme Procedure: list-copy lst
  -- C Function: scm_list_copy (lst)
      Return a (newly-created) copy of LST.
 
  -- Scheme Procedure: make-list n [init]
      Create a list containing 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' ( Copying).
 
Info Catalog (guile.info.gz) List Predicates (guile.info.gz) Lists (guile.info.gz) List Selection
automatically generated byinfo2html