GNU Info

Info Node: (cl)Substitution of Expressions

(cl)Substitution of Expressions


Next: Lists as Sets Prev: List Functions Up: Lists
Enter node , (file) or (file)node

Substitution of Expressions
===========================

These functions substitute elements throughout a tree of cons cells.
(Note: Sequence Functions, for the `substitute' function, which works
on just the top-level elements of a list.)

 - Function: subst new old tree &key :test :test-not :key
     This function substitutes occurrences of OLD with NEW in TREE, a
     tree of cons cells.  It returns a substituted tree, which will be
     a copy except that it may share storage with the argument TREE in
     parts where no substitutions occurred.  The original TREE is not
     modified.  This function recurses on, and compares against OLD,
     both `car's and `cdr's of the component cons cells.  If OLD is
     itself a cons cell, then matching cells in the tree are
     substituted as usual without recursively substituting in that
     cell.  Comparisons with OLD are done according to the specified
     test (`eql' by default).  The `:key' function is applied to the
     elements of the tree but not to OLD.

 - Function: nsubst new old tree &key :test :test-not :key
     This function is like `subst', except that it works by destructive
     modification (by `setcar' or `setcdr') rather than copying.

   The `subst-if', `subst-if-not', `nsubst-if', and `nsubst-if-not'
functions are defined similarly.

 - Function: sublis alist tree &key :test :test-not :key
     This function is like `subst', except that it takes an association
     list ALIST of OLD-NEW pairs.  Each element of the tree (after
     applying the `:key' function, if any), is compared with the `car's
     of ALIST; if it matches, it is replaced by the corresponding `cdr'.

 - Function: nsublis alist tree &key :test :test-not :key
     This is a destructive version of `sublis'.


automatically generated by info2www version 1.2.2.9