manpagez: man pages & more
info r5rs
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1.2 Literal expressions

syntax: quote <datum>
syntax: '<datum>
syntax: <constant>

(quote <datum>)’ evaluates to <datum>. <Datum> may be any external representation of a Scheme object (see section External representations). This notation is used to include literal constants in Scheme code.

(quote a)                              ⇒  a
(quote #(a b c))                       ⇒  #(a b c)
(quote (+ 1 2))                        ⇒  (+ 1 2)

(quote <datum>)’ may be abbreviated as <datum>. The two notations are equivalent in all respects.

'a                                     ⇒  a
'#(a b c)                              ⇒  #(a b c)
'()                                    ⇒  ()
'(+ 1 2)                               ⇒  (+ 1 2)
'(quote a)                             ⇒  (quote a)
''a                                    ⇒  (quote a)

Numerical constants, string constants, character constants, and boolean constants evaluate “to themselves”; they need not be quoted.

'"abc"                                 ⇒  "abc"
"abc"                                  ⇒  "abc"
'145932                                ⇒  145932
145932                                 ⇒  145932
'#t                                    ⇒  #t
#t                                     ⇒  #t

As noted in section Storage model, it is an error to alter a constant (i.e. the value of a literal expression) using a mutation procedure like ‘set-car!’ or ‘string-set!’.


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

This document was generated on March 31, 2014 using texi2html 5.0.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.