User Tools


Accessor REST

Syntax

  • rest listtail
  • (setf (rest list) new-tail)

Arguments and Values

Description

rest performs the same operation as cdr, but mnemonically complements first. Specifically,

(rest list) ≡ (cdr list) (setf (rest list) new-tail) ≡ (setf (cdr list) new-tail)

Examples

(rest '(1 2))

(2)

(rest '(1 . 2))

2

(rest '(1))

NIL

(defparameter *cons* '(1 . 2))

*CONS*

(setf (rest *cons*) "two")

"two"

*cons*

(1 . "two")

Side Effects

None.

Affected By

None.

Exceptional Situations

None.

See Also

Example Implementation

rest is often preferred stylistically over cdr when the argument is to being subjectively viewed as a list rather than as a cons.

Notes

None.

\issue{DOTTED-LIST-ARGUMENTS:CLARIFY}