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


Programming in Emacs Lisp

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

7.2 cons

The cons function constructs lists; it is the inverse of car and cdr. For example, cons can be used to make a four element list from the three element list, (fir oak maple):

 
(cons 'pine '(fir oak maple))

After evaluating this list, you will see

 
(pine fir oak maple)

appear in the echo area. cons puts a new element at the beginning of a list; it attaches or pushes elements onto the list.

Build a list  
7.2.1 Find the Length of a List: length  How to find the length of a list.


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