ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   14 Conses   14.2 Dictionary of Conses

14.2.32 rest Accessor

Syntax:
rest list    tail

(setf (rest list) new-tail)

Arguments and Values:
list - a list, which might be a dotted list or a circular list.

tail - an object.

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
 (setq *cons* '(1 . 2))  (1 . 2)
 (setf (rest *cons*) "two")  "two"
 *cons*  (1 . "two")

See Also:
cdr, nthcdr

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

Allegro CL Implementation Details:
None.

Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2019 - File last updated 02-07-2019