comparison man/lispref/objects.texi @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents 6240c7796c7a
children 7d59cb494b73
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the XEmacs Lisp Reference Manual. 2 @c This is part of the XEmacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 @c See the file lispref.texi for copying conditions. 4 @c See the file lispref.texi for copying conditions.
5 @setfilename ../../info/objects.info 5 @setfilename ../../info/objects.info
6 @node Lisp Data Types, Numbers, Introduction, Top 6 @node Lisp Data Types, Numbers, Introduction, Top
7 @chapter Lisp Data Types 7 @chapter Lisp Data Types
8 @cindex object 8 @cindex object
24 A few fundamental object types are built into XEmacs. These, from 24 A few fundamental object types are built into XEmacs. These, from
25 which all other types are constructed, are called @dfn{primitive types}. 25 which all other types are constructed, are called @dfn{primitive types}.
26 Each object belongs to one and only one primitive type. These types 26 Each object belongs to one and only one primitive type. These types
27 include @dfn{integer}, @dfn{character} (starting with XEmacs 20.0), 27 include @dfn{integer}, @dfn{character} (starting with XEmacs 20.0),
28 @dfn{float}, @dfn{cons}, @dfn{symbol}, @dfn{string}, @dfn{vector}, 28 @dfn{float}, @dfn{cons}, @dfn{symbol}, @dfn{string}, @dfn{vector},
29 @dfn{bit-vector}, @dfn{subr}, @dfn{compiled-function}, @dfn{hashtable}, 29 @dfn{bit-vector}, @dfn{subr}, @dfn{compiled-function}, @dfn{hash-table},
30 @dfn{range-table}, @dfn{char-table}, @dfn{weak-list}, and several 30 @dfn{range-table}, @dfn{char-table}, @dfn{weak-list}, and several
31 special types, such as @dfn{buffer}, that are related to editing. 31 special types, such as @dfn{buffer}, that are related to editing.
32 (@xref{Editing Types}.) 32 (@xref{Editing Types}.)
33 33
34 Each primitive type has a corresponding Lisp function that checks 34 Each primitive type has a corresponding Lisp function that checks
171 @item 171 @item
172 frame 172 frame
173 @item 173 @item
174 glyph 174 glyph
175 @item 175 @item
176 hashtable 176 hash-table
177 @item 177 @item
178 image-instance 178 image-instance
179 @item 179 @item
180 integer 180 integer
181 @item 181 @item
405 provides for characters. 405 provides for characters.
406 406
407 The usual read syntax for alphanumeric characters is a question mark 407 The usual read syntax for alphanumeric characters is a question mark
408 followed by the character; thus, @samp{?A} for the character 408 followed by the character; thus, @samp{?A} for the character
409 @kbd{A}, @samp{?B} for the character @kbd{B}, and @samp{?a} for the 409 @kbd{A}, @samp{?B} for the character @kbd{B}, and @samp{?a} for the
410 character @kbd{a}. 410 character @kbd{a}.
411 411
412 For example: 412 For example:
413 413
414 @example 414 @example
415 ;; @r{Under XEmacs 20:} 415 ;; @r{Under XEmacs 20:}
1049 @example 1049 @example
1050 "It is useful to include newlines 1050 "It is useful to include newlines
1051 in documentation strings, 1051 in documentation strings,
1052 but the newline is \ 1052 but the newline is \
1053 ignored if escaped." 1053 ignored if escaped."
1054 @result{} "It is useful to include newlines 1054 @result{} "It is useful to include newlines
1055 in documentation strings, 1055 in documentation strings,
1056 but the newline is ignored if escaped." 1056 but the newline is ignored if escaped."
1057 @end example 1057 @end example
1058 1058
1059 A string can hold extents and properties of the text it contains, in 1059 A string can hold extents and properties of the text it contains, in
1060 addition to the characters themselves. This enables programs that copy 1060 addition to the characters themselves. This enables programs that copy
1251 one Lisp object to another, using an internal indexing method 1251 one Lisp object to another, using an internal indexing method
1252 called @dfn{hashing}. Hash tables are very fast (much more efficient 1252 called @dfn{hashing}. Hash tables are very fast (much more efficient
1253 that using an association list, when there are a large number of 1253 that using an association list, when there are a large number of
1254 elements in the table). 1254 elements in the table).
1255 1255
1256 Hash tables have no read syntax. They print in hash notation (The 1256 Hash tables have a special read syntax beginning with
1257 ``hash'' in ``hash notation'' has nothing to do with the ``hash'' in 1257 @samp{#s(hash-table} (this is an example of @dfn{structure} read
1258 ``hash table''), giving the number of elements, total space allocated 1258 syntax. This notation is also used for printing when
1259 for elements, and a unique number assigned at the time the hash table 1259 @code{print-readably} is @code{t}.
1260 was created. (Hash tables automatically resize as necessary so there 1260
1261 is no danger of running out of space for elements.) 1261 Otherwise they print in hash notation (The ``hash'' in ``hash notation''
1262 1262 has nothing to do with the ``hash'' in ``hash table''), giving the
1263 @example 1263 number of elements, total space allocated for elements, and a unique
1264 @group 1264 number assigned at the time the hash table was created. (Hash tables
1265 (make-hashtable 50) 1265 automatically resize as necessary so there is no danger of running out
1266 @result{} #<hashtable 0/71 0x313a> 1266 of space for elements.)
1267
1268 @example
1269 @group
1270 (make-hash-table :size 50)
1271 @result{} #<hash-table 0/107 0x313a>
1267 @end group 1272 @end group
1268 @end example 1273 @end example
1269 1274
1270 @xref{Hash Tables}, for information on how to create and work with hash 1275 @xref{Hash Tables}, for information on how to create and work with hash
1271 tables. 1276 tables.
1981 @xref{Specifier Types, generic-specifier-p}. 1986 @xref{Specifier Types, generic-specifier-p}.
1982 1987
1983 @item glyphp 1988 @item glyphp
1984 @xref{Glyphs, glyphp}. 1989 @xref{Glyphs, glyphp}.
1985 1990
1986 @item hashtablep 1991 @item hash-table-p
1987 @xref{Hash Tables, hashtablep}. 1992 @xref{Hash Tables, hash-table-p}.
1988 1993
1989 @item icon-glyph-p 1994 @item icon-glyph-p
1990 @xref{Glyph Types, icon-glyph-p}. 1995 @xref{Glyph Types, icon-glyph-p}.
1991 1996
1992 @item image-instance-p 1997 @item image-instance-p
2151 @var{object}. The value is one of @code{bit-vector}, @code{buffer}, 2156 @var{object}. The value is one of @code{bit-vector}, @code{buffer},
2152 @code{char-table}, @code{character}, @code{charset}, 2157 @code{char-table}, @code{character}, @code{charset},
2153 @code{coding-system}, @code{cons}, @code{color-instance}, 2158 @code{coding-system}, @code{cons}, @code{color-instance},
2154 @code{compiled-function}, @code{console}, @code{database}, 2159 @code{compiled-function}, @code{console}, @code{database},
2155 @code{device}, @code{event}, @code{extent}, @code{face}, @code{float}, 2160 @code{device}, @code{event}, @code{extent}, @code{face}, @code{float},
2156 @code{font-instance}, @code{frame}, @code{glyph}, @code{hashtable}, 2161 @code{font-instance}, @code{frame}, @code{glyph}, @code{hash-table},
2157 @code{image-instance}, @code{integer}, @code{keymap}, @code{marker}, 2162 @code{image-instance}, @code{integer}, @code{keymap}, @code{marker},
2158 @code{process}, @code{range-table}, @code{specifier}, @code{string}, 2163 @code{process}, @code{range-table}, @code{specifier}, @code{string},
2159 @code{subr}, @code{subwindow}, @code{symbol}, @code{toolbar-button}, 2164 @code{subr}, @code{subwindow}, @code{symbol}, @code{toolbar-button},
2160 @code{tooltalk-message}, @code{tooltalk-pattern}, @code{vector}, 2165 @code{tooltalk-message}, @code{tooltalk-pattern}, @code{vector},
2161 @code{weak-list}, @code{window}, @code{window-configuration}, or 2166 @code{weak-list}, @code{window}, @code{window-configuration}, or