As in other Lisp dialects, CHICKEN supports "property lists" associated with symbols. Properties are accessible via a key that can be any kind of value but which will be compared using eq?.
- get SYMBOL PROPERTY #!optional DEFAULTprocedure
Returns the value stored under the key PROPERTY in the property list of SYMBOL. If no such property is stored, returns DEFAULT. The DEFAULT is optional and defaults to #f.
- put! SYMBOL PROPERTY VALUEprocedure
- (set! (get SYMBOL PROPERTY) VALUE)procedure
Stores VALUE under the key PROPERTY in the property list of SYMBOL replacing any previously stored value.
- remprop! SYMBOL PROPERTYprocedure
Deletes the first property matching the key PROPERTY in the property list of SYMBOL. Returns #t when a deletion performed, and #f otherwise.
- symbol-plist SYMBOLprocedure
- set! (symbol-plist SYMBOL) LSTprocedure
Returns the property list of SYMBOL or sets it. The property list is a flat list of alternating properties and values.
This list is not guaranteed to be a fresh copy, so avoid mutating it directly.
- get-properties SYMBOL PROPERTIESprocedure
Searches the property list of SYMBOL for the first property with a key in the list PROPERTIES. Returns 3 values: the matching property key, value, and the tail of property list after the matching property. When no match found all values are #f.
This tail of the property list is not guaranteed to be a fresh copy, so avoid mutating it directly.
PROPERTIES may also be an atom, in which case it is treated as a list of one element.
Previous: Module (chicken platform)
Next: Module (chicken port)