Copyright (C) 2000-2012 |
GNU Info (librep.info)Property ListsProperty Lists -------------- Each symbol has a property list (or "plist"), this is a structure which associates an arbitrary Lisp object with a key (usually a symbol). The keys in a plist may not have any duplications (so that each property is only defined once). The concept of a property list is very similar to an association list (Note: Association Lists) but there are two main differences: 1. Structure; each element of an alist represents one key/association pair. In a plist each pair of elements represents an association: the first is the key, the second the property. For example, where an alist may be, ((one . 1) (two . 2) (three . 3)) a property list would be, (one 1 two 2 three 3) 2. Plists have their own set of functions to modify the list. This is done destructively, altering the property list (since the plist is stored in only one location, the symbol, this is quite safe). - Function: get symbol property This function searches the property list of the symbol SYMBOL for a property `equal' to PROPERTY. If such a property is found it is returned, otherwise false is returned. (get 'if 'lisp-indent) => 2 (get 'set 'lisp-indent) => () - Function: put symbol property new-value `put' sets the value of the property PROPERTY to NEW-VALUE in the property list of the symbol SYMBOL. If there is an existing value for this property (using `equal' to compare keys) it is overwritten. The value returned is NEW-VALUE. (put 'foo 'prop 200) => 200 - Function: symbol-plist symbol Returns the property list of the symbol SYMBOL. (symbol-plist 'if) => (lisp-indent 2) - Function: setplist symbol plist This function sets the property list of the symbol SYMBOL to PLIST. (setplist 'foo '(zombie yes)) => (zombie yes) automatically generated by info2www version 1.2.2.9 |