@c -*-texinfo-*-
@c This is part of the GNU Emacs Lisp Reference Manual.
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
-@c Free Software Foundation, Inc.
+@c Free Software Foundation, Inc.
@c See the file elisp.texi for copying conditions.
@setfilename ../info/objects
@node Lisp Data Types, Numbers, Introduction, Top
The range of values for integers in Emacs Lisp is @minus{}134217728 to
134217727 (28 bits; i.e.,
-@ifinfo
+@ifnottex
-2**27
-@end ifinfo
+@end ifnottex
@tex
@math{-2^{27}}
@end tex
to
-@ifinfo
+@ifnottex
2**27 - 1)
-@end ifinfo
+@end ifnottex
@tex
@math{2^{28}-1})
@end tex
@node Floating Point Type
@subsection Floating Point Type
- Emacs supports floating point numbers (though there is a compilation
-option to disable them). The precise range of floating point numbers is
-machine-specific.
+ Floating point numbers are the computer equivalent of scientific
+notation. The precise number of significant figures and the range of
+possible exponents is machine-specific; Emacs always uses the C data
+type @code{double} to store the value.
The printed representation for floating point numbers requires either
a decimal point (with at least one digit following), an exponent, or
Characters in strings, buffers, and files are currently limited to the
range of 0 to 524287---nineteen bits. But not all values in that range
-are valid character codes. Codes 0 through 127 are ASCII codes; the
-rest are non-ASCII (@pxref{Non-ASCII Characters}). Characters that represent
+are valid character codes. Codes 0 through 127 are @sc{ascii} codes; the
+rest are non-@sc{ascii} (@pxref{Non-ASCII Characters}). Characters that represent
keyboard input have a much wider range, to encode modifier keys such as
Control, Meta and Shift.
The usual read syntax for alphanumeric characters is a question mark
followed by the character; thus, @samp{?A} for the character
@kbd{A}, @samp{?B} for the character @kbd{B}, and @samp{?a} for the
-character @kbd{a}.
+character @kbd{a}.
For example:
@cindex @samp{\r}
@cindex escape
@cindex @samp{\e}
+@cindex space
+@cindex @samp{\s}
You can express the characters Control-g, backspace, tab, newline,
-vertical tab, formfeed, return, and escape as @samp{?\a}, @samp{?\b},
-@samp{?\t}, @samp{?\n}, @samp{?\v}, @samp{?\f}, @samp{?\r}, @samp{?\e},
-respectively. Thus,
+vertical tab, formfeed, space, return, del, and escape as @samp{?\a},
+@samp{?\b}, @samp{?\t}, @samp{?\n}, @samp{?\v}, @samp{?\f},
+@samp{?\r}, @samp{?\d}, @samp{?\e}, and @samp{?\s}, respectively. Thus,
@example
?\a @result{} 7 ; @r{@kbd{C-g}}
?\f @result{} 12 ; @r{formfeed character, @kbd{C-l}}
?\r @result{} 13 ; @r{carriage return, @key{RET}, @kbd{C-m}}
?\e @result{} 27 ; @r{escape character, @key{ESC}, @kbd{C-[}}
+?\s @result{} 32 ; @r{space character, @key{SPC}}
?\\ @result{} 92 ; @r{backslash character, @kbd{\}}
?\d @result{} 127 ; @r{delete character, @key{DEL}}
@end example
@tex
@math{2^{26}}
@end tex
-@ifinfo
+@ifnottex
2**26
-@end ifinfo
+@end ifnottex
bit as well as the code for the corresponding non-control
character. Ordinary terminals have no way of generating non-@sc{ascii}
control characters, but you can generate them straightforwardly using X
@tex
@math{2^{27}}
@end tex
-@ifinfo
+@ifnottex
2**27
-@end ifinfo
+@end ifnottex
bit set (which on most machines makes it a negative number). We
use high bits for this and other modifiers to make possible a wide range
of basic character codes.
@tex
@math{2^{7}}
@end tex
-@ifinfo
+@ifnottex
2**7
-@end ifinfo
-bit attached to an ASCII character indicates a meta character; thus, the
+@end ifnottex
+bit attached to an @sc{ascii} character indicates a meta character; thus, the
meta characters that can fit in a string have codes in the range from
128 to 255, and are the meta versions of the ordinary @sc{ascii}
characters. (In Emacs versions 18 and older, this convention was used
@tex
@math{2^{25}}
@end tex
-@ifinfo
+@ifnottex
2**25
-@end ifinfo
+@end ifnottex
bit to indicate that the shift key was used in typing a control
character. This distinction is possible only when you use X terminals
or other special terminals; ordinary terminals do not report the
distinction to the computer in any way. The Lisp syntax for
-the shift bit is @samp{\S-}; thus, @samp{?\C-\S-o} or @samp{?\C-\S-O}
+the shift bit is @samp{\S-}; thus, @samp{?\C-\S-o} or @samp{?\C-\S-O}
represents the shifted-control-o character.
@cindex hyper characters
in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes
for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. (Case is
significant in these prefixes.) Thus, @samp{?\H-\M-\A-x} represents
-@kbd{Alt-Hyper-Meta-x}.
+@kbd{Alt-Hyper-Meta-x}. Note that @samp{\s} (without the @samp{-})
+represents the space character.
@tex
Numerically, the
bit values are @math{2^{22}} for alt, @math{2^{23}} for super and @math{2^{24}} for hyper.
@end tex
-@ifinfo
+@ifnottex
Numerically, the
bit values are 2**22 for alt, 2**23 for super and 2**24 for hyper.
-@end ifinfo
+@end ifnottex
@cindex @samp{\} in character constant
@cindex backslash in character constant
and the hexadecimal character code. You can use any number of hex
digits, so you can represent any character code in this way.
Thus, @samp{?\x41} for the character @kbd{A}, @samp{?\x1} for the
-character @kbd{C-a}, and @code{?\x8e0} for the character
+character @kbd{C-a}, and @code{?\x8e0} for the Latin-1 character
@iftex
@samp{@`a}.
@end iftex
-@ifinfo
+@ifnottex
@samp{a} with grave accent.
-@end ifinfo
+@end ifnottex
A backslash is allowed, and harmless, preceding any character without
a special escape meaning; thus, @samp{?\+} is equivalent to @samp{?+}.
@samp{()\|;'`"#.,} to avoid confusing the Emacs commands for editing
Lisp code. Also add a backslash before whitespace characters such as
space, tab, newline and formfeed. However, it is cleaner to use one of
-the easily readable escape sequences, such as @samp{\t}, instead of an
-actual whitespace character such as a tab.
+the easily readable escape sequences, such as @samp{\t} or @samp{\s},
+instead of an actual whitespace character such as a tab or a space.
@node Symbol Type
@subsection Symbol Type
@samp{-+=*/}. Such names require no special punctuation; the characters
of the name suffice as long as the name does not look like a number.
(If it does, write a @samp{\} at the beginning of the name to force
-interpretation as a symbol.) The characters @samp{_~!@@$%^&:<>@{@}} are
+interpretation as a symbol.) The characters @samp{_~!@@$%^&:<>@{@}?} are
less often used but also require no special punctuation. Any other
characters may be included in a symbol's name by escaping them with a
backslash. In contrast to its use in strings, however, a backslash in
@end group
@end example
+@ifinfo
+@c This uses ``colon'' instead of a literal `:' because Info cannot
+@c cope with a `:' in a menu
+@cindex @samp{#@var{colon}} read syntax
+@end ifinfo
+@ifnotinfo
@cindex @samp{#:} read syntax
+@end ifnotinfo
Normally the Lisp reader interns all symbols (@pxref{Creating
Symbols}). To prevent interning, you can write @samp{#:} before the
name of the symbol.
Arrays are further subdivided into strings, vectors, char-tables and
bool-vectors. Vectors can hold elements of any type, but string
elements must be characters, and bool-vector elements must be @code{t}
-or @code{nil}. The characters in a string can have text properties like
-characters in a buffer (@pxref{Text Properties}); vectors and
-bool-vectors do not support text properties even when their elements
-happen to be characters. Char-tables are like vectors except that they
-are indexed by any valid character code.
+or @code{nil}. Char-tables are like vectors except that they are
+indexed by any valid character code. The characters in a string can
+have text properties like characters in a buffer (@pxref{Text
+Properties}), but vectors do not support text properties, even when
+their elements happen to be characters.
Lists, strings and the other array types are different, but they have
important similarities. For example, all have a length @var{l}, and all
@code{(@var{a} .@: @var{b})} stands for a cons cell whose @sc{car} is
the object @var{a}, and whose @sc{cdr} is the object @var{b}. Dotted
pair notation is therefore more general than list syntax. In the dotted
-pair notation, the list @samp{(1 2 3)} is written as @samp{(1 . (2 . (3
+pair notation, the list @samp{(1 2 3)} is written as @samp{(1 . (2 . (3
. nil)))}. For @code{nil}-terminated lists, you can use either
notation, but list notation is usually clearer and more convenient.
When printing a list, the dotted pair notation is only used if the
Similarly, the three-element list @code{(rose violet buttercup)}
is equivalent to @code{(rose . (violet . (buttercup)))}.
-@ifinfo
+@ifnottex
It looks like this:
@example
--> rose --> violet --> buttercup
@end group
@end example
-@end ifinfo
+@end ifnottex
@node Association List Type
@comment node-name, next, previous, up
@example
(setq alist-of-colors
- '((rose . red) (lily . white) (buttercup . yellow)))
+ '((rose . red) (lily . white) (buttercup . yellow)))
@end example
@noindent
in documentation strings,
but the newline is \
ignored if escaped."
- @result{} "It is useful to include newlines
-in documentation strings,
+ @result{} "It is useful to include newlines
+in documentation strings,
but the newline is ignored if escaped."
@end example
@node Non-ASCII in Strings
-@subsubsection Non-ASCII Characters in Strings
+@subsubsection Non-@sc{ascii} Characters in Strings
You can include a non-@sc{ascii} international character in a string
constant by writing it literally. There are two text representations
represent a unibyte non-@sc{ascii} character with its character code,
which must be in the range from 128 (0200 octal) to 255 (0377 octal).
This forces a unibyte string.
-
+
@xref{Text Representations}, for more information about the two
text representations.
@tex
@math{2^{7}}
@end tex
-@ifinfo
+@ifnottex
2**7
-@end ifinfo
+@end ifnottex
bit of the character in the string. If the string is used in
@code{define-key} or @code{lookup-key}, this numeric code is translated
into the equivalent meta character. @xref{Character Type}.
Character category tables (@pxref{Categories}).
@item
-Display Tables (@pxref{Display Tables}).
+Display tables (@pxref{Display Tables}).
@item
Syntax tables (@pxref{Syntax Tables}).
constant that follows actually specifies the contents of the bool-vector
as a bitmap---each ``character'' in the string contains 8 bits, which
specify the next 8 elements of the bool-vector (1 stands for @code{t},
-and 0 for @code{nil}). The least significant bits of the character
+and 0 for @code{nil}). The least significant bits of the character
correspond to the lowest indices in the bool-vector. If the length is not a
multiple of 8, the printed representation shows extra elements, but
these extras really make no difference.
@item keymapp
@xref{Creating Keymaps, keymapp}.
+@item keywordp
+@xref{Constant Variables}.
+
@item listp
@xref{List-related Predicates, listp}.