comparison man/cl.texi @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 3ecd8885ac67
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
293 case, a @samp{*} has been appended to the Common Lisp name to obtain 293 case, a @samp{*} has been appended to the Common Lisp name to obtain
294 the Emacs name: 294 the Emacs name:
295 295
296 @example 296 @example
297 defun* defsubst* defmacro* function* 297 defun* defsubst* defmacro* function*
298 member* assoc* rassoc* get* 298 member* assoc* rassoc* remove*
299 remove* delete* mapcar* sort* 299 delete* mapcar* sort* floor*
300 floor* ceiling* truncate* round* 300 ceiling* truncate* round* mod*
301 mod* rem* random* 301 rem* random*
302 @end example 302 @end example
303 303
304 Internal function and variable names in the package are prefixed 304 Internal function and variable names in the package are prefixed
305 by @code{cl-}. Here is a complete list of functions @emph{not} 305 by @code{cl-}. Here is a complete list of functions @emph{not}
306 prefixed by @code{cl-} which were not taken from Common Lisp: 306 prefixed by @code{cl-} which were not taken from Common Lisp:
1082 @smallexample 1082 @smallexample
1083 car cdr caar .. cddddr 1083 car cdr caar .. cddddr
1084 nth rest first .. tenth 1084 nth rest first .. tenth
1085 aref elt nthcdr 1085 aref elt nthcdr
1086 symbol-function symbol-value symbol-plist 1086 symbol-function symbol-value symbol-plist
1087 get get* getf 1087 get getf gethash
1088 gethash subseq 1088 subseq
1089 @end smallexample 1089 @end smallexample
1090 1090
1091 @noindent 1091 @noindent
1092 Note that for @code{nthcdr} and @code{getf}, the list argument 1092 Note that for @code{nthcdr} and @code{getf}, the list argument
1093 of the function must itself be a valid @var{place} form. For 1093 of the function must itself be a valid @var{place} form. For
3295 @noindent 3295 @noindent
3296 This package defines several symbol-related features that were 3296 This package defines several symbol-related features that were
3297 missing from Emacs Lisp. 3297 missing from Emacs Lisp.
3298 3298
3299 @menu 3299 @menu
3300 * Property Lists:: `get*', `remprop', `getf', `remf' 3300 * Property Lists:: `remprop', `getf', `remf'
3301 * Creating Symbols:: `gensym', `gentemp' 3301 * Creating Symbols:: `gensym', `gentemp'
3302 @end menu 3302 @end menu
3303 3303
3304 @node Property Lists, Creating Symbols, Symbols, Symbols 3304 @node Property Lists, Creating Symbols, Symbols, Symbols
3305 @section Property Lists 3305 @section Property Lists
3307 @noindent 3307 @noindent
3308 These functions augment the standard Emacs Lisp functions @code{get} 3308 These functions augment the standard Emacs Lisp functions @code{get}
3309 and @code{put} for operating on properties attached to symbols. 3309 and @code{put} for operating on properties attached to symbols.
3310 There are also functions for working with property lists as 3310 There are also functions for working with property lists as
3311 first-class data structures not attached to particular symbols. 3311 first-class data structures not attached to particular symbols.
3312
3313 @defun get* symbol property &optional default
3314 This function is like @code{get}, except that if the property is
3315 not found, the @var{default} argument provides the return value.
3316 (The Emacs Lisp @code{get} function always uses @code{nil} as
3317 the default; this package's @code{get*} is equivalent to Common
3318 Lisp's @code{get}.)
3319
3320 The @code{get*} function is @code{setf}-able; when used in this
3321 fashion, the @var{default} argument is allowed but ignored.
3322 @end defun
3323 3312
3324 @defun remprop symbol property 3313 @defun remprop symbol property
3325 This function removes the entry for @var{property} from the property 3314 This function removes the entry for @var{property} from the property
3326 list of @var{symbol}. It returns a true value if the property was 3315 list of @var{symbol}. It returns a true value if the property was
3327 indeed found and removed, or @code{nil} if there was no such property. 3316 indeed found and removed, or @code{nil} if there was no such property.
3355 3344
3356 @example 3345 @example
3357 (put sym prop val) @equiv{} (setf (getf (symbol-plist sym) prop) val) 3346 (put sym prop val) @equiv{} (setf (getf (symbol-plist sym) prop) val)
3358 @end example 3347 @end example
3359 3348
3360 The @code{get} and @code{get*} functions are also @code{setf}-able. 3349 The @code{get} function is also @code{setf}-able. The fact that
3361 The fact that @code{default} is ignored can sometimes be useful: 3350 @code{default} is ignored can sometimes be useful:
3362 3351
3363 @example 3352 @example
3364 (incf (get* 'foo 'usage-count 0)) 3353 (incf (get 'foo 'usage-count 0))
3365 @end example 3354 @end example
3366 3355
3367 Here, symbol @code{foo}'s @code{usage-count} property is incremented 3356 Here, symbol @code{foo}'s @code{usage-count} property is incremented
3368 if it exists, or set to 1 (an incremented 0) otherwise. 3357 if it exists, or set to 1 (an incremented 0) otherwise.
3369 3358
4651 @code{gethash}. If @var{key} already exists in the table, the 4640 @code{gethash}. If @var{key} already exists in the table, the
4652 corresponding value is changed to the stored value. If @var{key} 4641 corresponding value is changed to the stored value. If @var{key}
4653 does not already exist, a new entry is added to the table and the 4642 does not already exist, a new entry is added to the table and the
4654 table is reallocated to a larger size if necessary. The @var{default} 4643 table is reallocated to a larger size if necessary. The @var{default}
4655 argument is allowed but ignored in this case. The situation is 4644 argument is allowed but ignored in this case. The situation is
4656 exactly analogous to that of @code{get*}; @pxref{Property Lists}. 4645 exactly analogous to that of @code{get}; @pxref{Property Lists}.
4657 @end defun 4646 @end defun
4658 4647
4659 @defun remhash key table 4648 @defun remhash key table
4660 This function removes the entry for @var{key} from @var{table}. 4649 This function removes the entry for @var{key} from @var{table}.
4661 If an entry was removed, it returns @code{t}. If @var{key} does 4650 If an entry was removed, it returns @code{t}. If @var{key} does