6.6.1.3 Transient-CH-Replay-Set Operations

Method: empty? (transient-ch-replay-set)  trs

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

Method: size (transient-ch-replay-set)  trs

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

Method: arb (transient-ch-replay-set)  trs

Returns an arbitrary element of the current contents of trs. Specifically, on a nonempty set, returns two values: an arbitrary element and true; on an empty set, returns two false values. O(1).

Method: first (transient-ch-replay-set)  trs

If trs is nonempty, returns its first element (the first one added to it) and a true second value; otherwise, nil and false. O(1).

Method: last (transient-ch-replay-set)  trs

If trs is nonempty, returns its last element (the one most recently added to it) and a true second value; otherwise, nil and false. O(1).

Method: index (transient-ch-replay-set)  rs x

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

Method: at-index (transient-ch-replay-set)  rs idx

Returns the element at index idx within the ordering of rs. Signals an error if idx is out of bounds. O(log n).

Method: contains? (transient-ch-replay-set)  trs x

Returns true iff x is currently an element of trs. O(log n).

Method: clear! (transient-ch-replay-set)  trs

Removes all elements from trs, resetting it to the empty state. O(1).

Method: include! (transient-ch-replay-set)  trs value

Modifies trs so that it contains value. Has no effect if this was already the case. Returns trs. O(log n).

Method: exclude! (transient-ch-replay-set)  trs value

Modifies trs so that it does not contain value. Has no effect if this was already the case. Returns trs. O(log n).

Method: make-persistent (transient-ch-replay-set)  trs &key copy?

Returns a persistent FSet ch-replay-set (the usual kind, with functional semantics) with the contents of trs. 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.