(lispkit bitset)
Last updated
Last updated
Library (lispkit bitset)
implements bit sets of arbitrary size. Bit sets are mutable objects. The API of library (lispkit bitset)
provides functionality to create, to inspect, to compose, and to mutate bit sets efficiently.
(bitset? obj)
Returns #t
if obj is a bit set, #f
otherwise.
(bitset i ...)
Returns a new bit set with bits i ... set. Each i is a fixnum referring to one bit in the bit set by its ordinality.
(list->bitset list)
Returns a new bit set with bits specified by list. Each element in list is a fixnum referring to one bit in the bit set by its ordinality.
(bitset-copy bs)
Returns a copy of bit set bs.
(bitset-size bs)
Returns the number of bits set in bit set bs.
(bitset-next bs) (bitset-next bs i)
Returns the next bit set in bs following bit i. If i is not provided, the first bit set in bs is returned.
(bitset-empty? bs)
Returns #t
if bit set bs is empty, #f
otherwise.
(bitset-disjoint? bs1 bs2)
Returns #t
if bit sets bs1 and bs2 are disjoint, #f
otherwise.
Returns #t
if bit set bs2 is a subset of bit set bs2, #f
otherwise.
Returns #t
if all bits i ... are set in bit set bs, #f
otherwise.
Inserts the bits i ... into bit set bs. bitset-adjoin!
returns bs.
Inserts all the bits specified by list into bit set bs. Each element in list is a fixnum referring to one bit in the bit set by its ordinality. bitset-adjoin-all!
returns bs.
Removes the bits i ... from bit set bs. bitset-delete!
returns bs.
Removes all the bits specified by list from bit set bs. Each element in list is a fixnum referring to one bit in the bit set by its ordinality. bitset-delete-all!
returns bs.
Computes the union of bit sets bs, bs1 ... and stores the result in bs. bitset-union!
returns bs.
Computes the intersection of bit sets bs, bs1 ... and stores the result in bs. bitset-intersection!
returns bs.
Computes the difference between bit sets bs and bs1 ... and stores the result in bs. bitset-difference!
returns bs.
Computes the exclusive disjunction of bit sets bs, bs1 ... and stores the result in bs. bitset-xor!
returns bs.
Returns #t
if the bit sets bs, bs1 ... are all equal, i.e. have the same bits set. Otherwise #f
is returned.
Returns #t
if bs is a proper subset of bs1, and bs1 is a proper subset of bs2, etc. Otherwise #f
is returned.
Returns #t
if bs is a proper superset of bs1, and bs1 is a proper superset of bs2, etc. Otherwise #f
is returned.
Returns #t
if bs is a subset of bs1, and bs1 is a subset of bs2, etc. Otherwise #f
is returned.
Returns #t
if bs is a superset of bs1, and bs1 is a superset of bs2, etc. Otherwise #f
is returned.
Returns a list of all bits set in bs.
Invokes proc on each bit set in bs in increasing ordinal order.
The current state is initialized to z, and proc is invoked on each bit of bs in increasing ordinal order and the current state, setting the current state to the result. The algorithm is repeated until all the bits of bs have been processed. Then the current state is returned.
Returns #t
if any application of pred to the bits of bs returns true, and #f
otherwise.
Returns #t
if every application of pred to the bits of bs returns true, and #f
otherwise.
Returns a new bit set containing the bits from bs that satisfy pred.
Removes all bits from bs for which pred returns #f
.
(bitset-subset? bs1 bs2)
(bitset-contains? bs i ...)
(bitset-adjoin! bs i ...)
(bitset-adjoin-all! bs list)
(bitset-delete! bs i ...)
(bitset-delete-all! bs list)
(bitset-union! bs bs1 ...)
(bitset-intersection! bs bs1 ...)
(bitset-difference! bs bs1 ...)
(bitset-xor! bs bs1 ...)
(bitset=? bs bs1 ...)
(bitset<? bs bs1 ...)
(bitset>? bs bs1 ...)
(bitset<=? bs bs1 ...)
(bitset>=? bs bs1 ...)
(bitset->list bs)
(bitset-for-each proc bs)
(bitset-fold proc z bs)
(bitset-any? pred bs)
(bitset-every? pred bs)
(bitset-filter pred bs)
(bitset-filter! pred bs)