Next: , Previous: , Up: chains   [Index]


35.2 Chain objects

Chains are doubly–linked lists composed of <chain-link> instances. In this documentation: chain objects arguments to functions are indicated as chain, and they can be either null or instances of <chain-link>.

The following syntactic bindings are exported by the library (vicare containers chains). The bindings whose name is prefixed with $ are unsafe operations: they do not validate their arguments before accessing them.

R6RS Record Type: <chain-link>

Record type representing a link in a chain. The <chain-link> type is non–generative and available for subtyping. In this documentation <chain-link> object arguments to functions are indicated as link.

Function: make-chain-link obj

Build and return a new instance of <chain-link> referencing obj as payload object.

Function: chain-link? obj

Return #t if obj is an instance of <chain-link>; otherwise return #f.

Function: chain obj

Build and return a new chain holding the given objects, which are pushed on the chain from right to left. If no arguments are given: return null.

Function: chain? obj

Return #t if obj is null or a a record of type <chain-link>; otherwise return #f.

Function: chain-link-ref link
Function: $chain-link-ref link

Return the payload object referenced by link.

Function: chain-link-set! link new-obj
Function: $chain-link-set! link new-obj

Store a new object as payload for link.

Object properties

Function: chain-link-putprop link key value
Function: $chain-link-putprop link key value

Add a new property key to the property list of link; key must be a symbol. If key is already set: the old entry is mutated to reference the new value.

Function: chain-link-getprop link key
Function: $chain-link-getprop link key

Return the value of the property key in the property list of link; if key is not set: return #f. key must be a symbol.

Function: chain-link-remprop link key
Function: $chain-link-remprop link key

Remove the property key from the property list of link; if key is not set: nothing happens. key must be a symbol.

Function: chain-link-property-list link
Function: $chain-link-property-list link

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

Other operations

Function: chain-link-hash link
Function: $chain-link-hash link

Return an exact integer to be used as hashtable key for link. Hashtables having a <chain-link> as key can be instantiated as follows:

(make-hashtable chain-link-hash eq?)

Next: , Previous: , Up: chains   [Index]