source: project/wiki/man/5/Module (chicken plist) @ 35527

Last change on this file since 35527 was 34261, checked in by sjamaan, 2 years ago

man/5: Add Module (chicken plist)

File size: 1.9 KB
Line 
1[[tags: manual]]
2[[toc:]]
3
4== Module (chicken plist)
5
6As in other Lisp dialects, CHICKEN supports "property lists"
7associated with symbols.  Properties are accessible via a key that can
8be any kind of value but which will be compared using {{eq?}}.
9
10=== get
11
12<procedure>(get SYMBOL PROPERTY [DEFAULT])</procedure>
13
14Returns the value stored under the key {{PROPERTY}} in the property
15list of {{SYMBOL}}. If no such property is stored, returns
16{{DEFAULT}}. The {{DEFAULT}} is optional and defaults to {{#f}}.
17
18=== put!
19
20<procedure>(put! SYMBOL PROPERTY VALUE)</procedure>
21<procedure>(set! (get SYMBOL PROPERTY) VALUE)</procedure>
22
23Stores {{VALUE}} under the key {{PROPERTY}} in the property list of
24{{SYMBOL}} replacing any previously stored value.
25
26=== remprop!
27
28<procedure>(remprop! SYMBOL PROPERTY)</procedure>
29
30Deletes the first property matching the key {{PROPERTY}} in the
31property list of {{SYMBOL}}. Returns {{#t}} when a deletion performed,
32and {{#f}} otherwise.
33
34=== symbol-plist
35
36<procedure>(symbol-plist SYMBOL)</procedure>
37<procedure>(set! (symbol-plist SYMBOL) LST)</procedure>
38
39Returns the property list of {{SYMBOL}} or sets it.  The property list
40is a flat list of alternating properties and values.
41
42This list is not guaranteed to be a fresh copy, so avoid mutating it
43directly.
44
45=== get-properties
46
47<procedure>(get-properties SYMBOL PROPERTIES)</procedure>
48
49Searches the property list of {{SYMBOL}} for the first property with a
50key in the list {{PROPERTIES}}. Returns 3 values: the matching
51property key, value, and the tail of property list after the matching
52property. When no match found all values are {{#f}}.
53
54This tail of the property list is not guaranteed to be a fresh copy,
55so avoid mutating it directly.
56
57{{PROPERTIES}} may also be an atom, in which case it is treated as a
58list of one element.
59
60---
61Previous: [[Module (chicken platform)]]
62
63Next: [[Module (chicken port)]]
Note: See TracBrowser for help on using the repository browser.