6.2.3 Transient-CH-Set Operations

Method: empty? (transient-ch-set)  ts

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

Method: size (transient-ch-set)  ts

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

Method: arb (transient-ch-set)  ts

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

Method: contains? (transient-ch-set)  ts x

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

Method: clear! (transient-ch-set)  ts

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

Method: include! (transient-ch-set)  ts value

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

Method: exclude! (transient-ch-set)  ts value

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

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

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