www.delorie.com/gnu/docs/elisp-manual-21/elisp_122.html   search  
Buy the book!

GNU Emacs Lisp Reference Manual

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

9.3 Quoting

The special form quote returns its single argument, as written, without evaluating it. This provides a way to include constant symbols and lists, which are not self-evaluating objects, in a program. (It is not necessary to quote self-evaluating objects such as numbers, strings, and vectors.)

Special Form: quote object
This special form returns object, without evaluating it.

Because quote is used so often in programs, Lisp provides a convenient read syntax for it. An apostrophe character (`'') followed by a Lisp object (in read syntax) expands to a list whose first element is quote, and whose second element is the object. Thus, the read syntax 'x is an abbreviation for (quote x).

Here are some examples of expressions that use quote:

(quote (+ 1 2))
     => (+ 1 2)
(quote foo)
     => foo
     => foo
     => (quote foo)
'(quote foo)
     => (quote foo)
     => [(quote foo)]

Other quoting constructs include function (see section 12.7 Anonymous Functions), which causes an anonymous lambda expression written in Lisp to be compiled, and ``' (see section 13.5 Backquote), which is used to quote only part of a list, while computing and substituting other parts.

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