6 Pict Rebuilds
method | ||||||
|
To support Pict.rebuild, the representation of a pict effectively records all primitive operations used to construct the pict. This recording is limited to Pict and Find objects. If, for example, you use Find.in to obtain a number and then construct a pict using that number, the number itself cannot record its derivation from the picts used with Find.in. In such cases, use rebuildable or the ~children argument of animate to establish a connection between the input picts and the result.
When traversing the children of pict to rebuild it, the pre_adjust function is applied to each pict before its own children. When pre_adjust returns a value other than the pict that it is given, rebuilding does not recur to its children, and the result of pre_adjust is used immediately as the rebuilt replacement for the given pict. When rebuilding does recur, when a pict’s descendants are unchanged and when config_adjust (if applicable) returns a configuration unchanged, then the original construction of the pict is kept. Finally, post_adjust is applied to either the rebuilt pict or so-far-preserved original pict to obtain the rebuilt replacement for the original pict. The replacement of a given pict is cached, so pre_adjust and post_adjust are each applied at most once to a pict within a call to Pict.rebuild.
A rebuilt pict–either pict itself or a rebuilt
dependency—
> def p = beside(~sep: 10, s, Pict.launder(s))
> p
This operation is equivalent to a use of Pict.rebuild:
| replacement
| p)
> p
This operation is equivalent to a use of Pict.rebuild:
| config ++ { key: val }
| config)
See "identity" for more information about pict identity and rebuilt picts.
function | ||||||||
|
The given deps list determines the replaceable dependencies of the result pict, but the result from proc determines the findable children.