6.6.2.3 Transient-CH-Replay-Map Operations

Note that although you can use either lookup or lookup! to retrieve a value from a transient map, and either default or default! to read its default, only the forms ending in ! can be used as a setf place.

Method: empty? (transient-ch-replay-map)  trm

Returns true iff trm is currently empty. O(1).

Method: size (transient-ch-replay-map)  trm

Returns the current number of elements in trm. O(1).

Method: arb (transient-ch-replay-map)  trm

Returns an arbitrary element of the current contents of trm. Specifically, on a nonempty map, returns three values: an arbitrary key, its value, and true; on an empty map, returns nil, nil, and false. O(1).

Method: first (transient-ch-replay-map)  trm

If trm is nonempty, returns, as three values, the first key that was added to trm, its most recently associated value, and true. If trm is empty, returns nil, nil, and false. O(log n).

Method: last (transient-ch-replay-map)  trm

If trm is nonempty, returns, as three values, the last (most recent) key that was added to trm, its most recently associated value, and true. If trm is empty, returns nil, nil, and false. O(log n).

Method: index (transient-ch-replay-map)  trm x

Returns the index of x within the ordering of the keys of trm, or nil if it is not found. NOTE: O(n).

Method: at-index (transient-ch-replay-map)  trm idx

Returns, as two values, the key at index idx within the ordering of trm and its associated value. Signals an error if idx is out of bounds. O(log n).

Method: contains? (transient-ch-replay-map)  trm key &optional value

Returns true iff key is currently a key of trm, and if value is supplied, it is the corresponding value. O(log n).

Method: clear! (transient-ch-replay-map)  trm

Removes all key/value pairs from trm, resetting it to the empty state. O(1).

Method: include! (transient-ch-replay-map)  trm key value

Modifies trm so that it maps key to value. Has no effect if this was already the case. Returns trm. O(log n).

Method: exclude! (transient-ch-replay-map)  trm key

Modifies trm so that it does not contain a mapping for key. Has no effect if this was already the case. Returns trm. O(log n).

Method: lookup (transient-ch-replay-map)  trm key
Method: lookup! (transient-ch-replay-map)  trm key

If trm currently contains a key equal to k, according to its key comparison function, returns three values: the corresponding value, true, and the key found; otherwise, the map’s default, false, and nil. If the key is not found and the map has no default, signals an error of type map-domain-error. O(log n).

Method: setf lookup! (t transient-ch-replay-map)  value trm key

Invoked as (setf (lookup! trm key) value). Modifies trm so that it maps key to value. Has no effect if this was already the case. Returns value (the CL spec for setf requires this). O(log n).

Method: default (transient-ch-replay-map)  trm
Method: default! (transient-ch-replay-map)  trm

Returns the default associated with trm.

Method: setf default! (transient-ch-replay-map)  trm new-default

Invoked as (setf (default! trm) new-default). Changes the default associated with trm to new-default.

Method: clear-default! (transient-ch-replay-map)  trm

Removes the default from trm. Subsequent lookups using keys not in the domain of trm will cause an error to be signalled.

Method: make-persistent (transient-ch-replay-map)  trm &key copy?

Returns a persistent FSet ch-replay-map (the usual kind, with functional semantics) with the contents of trm. Subsequent modifications to the transient are permitted, and of course will not affect the persistent one.

This operation has two modes, depending on copy?. If copy? is false (the default), it takes O(1) time; but subsequent modifications to the transient will behave performance-wise as if a new transient had been created. If copy? is true, the operation takes O(n) time, but subsequent modifications to the transient will run at full speed. Copying the collection also compacts it, so it uses less heap space.