Previous: , Up: iklib symbols   [Index]


6.29.4 Property lists

Property lists are key/value associations that can be attached to any Scheme symbol.

#!ikarus
(import (vicare))

(putprop 'ciao 'british 'hello)
(putprop 'ciao 'spanish 'hola)

(getprop 'ciao 'british)        ⇒ hello
(getprop 'ciao 'spanish)        ⇒ hola

(remprop 'ciao 'british)
(getprop 'ciao 'british)        ⇒ #f

(property-list 'ciao)           ⇒ ((spanish . hola))

The following bindings are exported by the library (vicare).

Function: putprop symbol key value

Add a new property key with value to the property list of symbol. key must be a symbol, value can be any value.

If key is already set: the old entry is mutated to reference the new value.

Function: getprop symbol key

Return the value of the property key in the property list of symbol; if key is not set return false. key must be a symbol.

Function: remprop symbol key

Remove property key from the list associated to symbol.

Function: property-list symbol

Return a new association list representing the property list of symbol. The order of the entries is the same as the property creation order.