6.6.2 Replay Maps

Data type: replay-map

The abstract class for FSet functional replay maps. Subclass of map.

Function: replay-map? x

Returns true iff x is an FSet functional replay map.

Data type: ch-replay-map

Functional replay maps implemented as pairs of a CHAMP map and a seq. Subclass of replay-map. These print as:

##{=| (k0 v0) (k1 v1) ... |}[key-compare-fn;val-compare-fn]/default

That is, there’s an = just inside the opening brace; otherwise they look like ch-maps. As always, the comparison function is printed only if it is not compare, and the default is printed only if it is not nil.

Function: ch-replay-map? x

Returns true iff x is an FSet functional CHAMP replay map.

Data type: transient-replay-map

The abstract class for FSet transient replay maps. Subclass of transient-map.

Function: transient-replay-map? x

Returns true iff x is an FSet transient replay map.

Function: empty-replay-map &key (default nil) no-default?
Function: empty-ch-replay-map &key (default nil) no-default? key-compare-fn-name val-compare-fn-name

Constructor function. Returns an empty ch-replay-map with the specified default, or with no default if no-default? is true. By default, its internal map will be organized by compare. To use a custom organization, key-compare-fn-name and val-compare-fn-name must be symbols naming the comparison functions to be used for keys and values respectively (these default to compare). A hash function must have been defined for each comparison function using define-hash-function. (A custom organization will not affect the map’s ordering for iteration or printing; the only reason you would need one is if you had a user-defined data type for which you had not defined methods on compare and hash-value.)

Macro: replay-map &rest subforms
Macro: ch-replay-map &rest subforms
Macro: ch-custom-replay-map key-compare-fn-name val-compare-fn-name &rest subforms

Constructor macro. Constructs a ch-replay-map according to the supplied argument subforms. Each argument subform can be a list of the form (key-expr value-expr), denoting a mapping from the value of key-expr to the value of value-expr; or a list of the form ($ expression), in which case the expression must evaluate to a map, denoting all its mappings; or the symbol :default, followed by a form; or the symbol :no-default. If :default is supplied, the map’s default is the value of the subsequent form; if :no-default is supplied, the map has no default; if neither, the map’s default is nil.

By default, its internal map will be organized by compare. To use a custom organization, use ch-custom-replay-map; key-compare-fn-name and val-compare-fn-name must be symbols naming the comparison functions to be used for keys and values respectively (these default to compare). A hash function must have been defined for each comparison function using define-hash-function. (A custom organization will not affect the map’s ordering for iteration or printing; the only reason you would need one is if you had a user-defined data type for which you had not defined methods on compare and hash-value.)

The result is constructed from the denoted mappings in left-to-right order; so if a given key is supplied by more than one argument subform, its associated value will be given by the rightmost such subform, but its position in the ordering by the leftmost.