Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

rplacd

rplacd

type: function (subr) 
location: built-in
source file: xllist.c
Common LISP compatible: yes
supported on: all machines

SYNTAX

(rplacd <list> <expr> )
        <list>          -       the list to DESTRUCTIVELY modify
        <expr>          -       the expression to replace the CDR of <list>

DESCRIPTION

RPLACD destructively modifies the CDR of <list> and replaces it with the <expr>. The destructive aspect of this operation means that the actual symbol value is used in the list-modifying operations - not a copy. <list> must evaluate to a valid list. An atom or NIL for <list> will result in an error.

EXAMPLES

(setq a '(1 2 3))                       ; set up A with (1 2 3)
(rplacd a 'new)                         ; returns (1 . NEW)
(print a)                               ; prints (1 . NEW)
                                        ; NOTE THAT A IS MODIFIED!
                                        ; 
(rplacd a '(a new list))                ; returns (1 A NEW LIST)
(rplacd '(1 2 3) '(more))               ; returns (1 MORE)
(rplacd 'a 'b)                          ; error: bad argument type
(rplacd NIL 'b)                         ; error: bad argument type


Go to the first, previous, next, last section, table of contents.