Function rplaca, rplacd

Syntax:

rplaca cons object cons

rplacd cons object cons

Pronunciation:

rplaca: [ˌrēˈplakə] or [ˌrəˈplakə]

rplacd: [ˌrēˈplakdə] or [ˌrəˈplakdə] or [ˌrēˈplakdē] or [ˌrəˈplakdē]

Arguments and Values:

cons—a cons.

object—an object.

Description:

15.3.0 4rplaca replaces the car of the cons with object. and then returns the modified \param{cons}.

rplacd replaces the cdr of the cons with object. and then returns the modified \param{cons}.

Examples:

15.3.0 3
 (defparameter *some-list* (list* 'one 'two 'three 'four)) → *some-list*
 *some-list* → (ONE TWO THREE . FOUR)
 (rplaca *some-list* 'uno) → (UNO TWO THREE . FOUR)
 *some-list* → (UNO TWO THREE . FOUR)
 (rplacd (last *some-list*) (list 'IV)) → (THREE IV)
 *some-list* → (UNO TWO THREE IV)

Side Effects:

15.3.0 1 15.3.0 2

The cons is modified.

Affected By:

None.

Exceptional Situations:

None.

See Also:

None.

Notes:

None.