www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro_110.html   search  
Buy the book!

Programming in Emacs Lisp

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. car, cdr, cons: Fundamental Functions

In Lisp, car, cdr, and cons are fundamental functions. The cons function is used to construct lists, and the car and cdr functions are used to take them apart.

In the walk through of the copy-region-as-kill function, we will see cons as well as two variants on cdr, namely, setcdr and nthcdr. (See section 8.5 copy-region-as-kill.)

Strange Names  An historical aside: why the strange names?
7.1 car and cdr  Functions for extracting part of a list.
7.2 cons  Constructing a list.
7.3 nthcdr  Calling cdr repeatedly.
7.4 nth  
7.5 setcar  Changing the first element of a list.
7.6 setcdr  Changing the rest of a list.
7.7 Exercise  

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003