A pair of attributes that thread through a tree in a depth-first left-to-right fashion.
Create a new attribute chain.
Create a new attribute chain. The update
functions provide ways to
influence the chain value, by taking the default computation of the
in
or out
attribute and returning a partial function. If the domain
of the partial function contains a node, then that function is used
to compute the chain value at the node n, otherwise the default chain
attribute is used. If an update function is omitted, it defaults
to the identity.
If the root of the tree is reached without a definition being supplied for the chain, a runtime exception is thrown. Both of the components of the chain are reset to avoid errors for cyclic if the exception is caught and they are subsequently evaluated again.
A decorator that propagates an attribute value down the tree.
A decorator that propagates an attribute value down the tree. The
partial function a
should define the value of the attribute at
nodes where it is known. If a
does not define a value for the
attribute at a particular node, then the decorator asks the parent
of the node for its value of the attribute and uses that value.
For this reason, a
should at least provide a value for the root
of the tree.
Decorators are higher-order operations that provide common patterns of tree attribution based on simple attributes or functions.