12.1 Bit Strings

Module BitString provides an interface to a fast and economical representation for immutable bit sequences.

IsBitString

{BitString.is +X ?B}

tests whether X is a bit string.

make

{BitString.make +I +L ?BitString}

creates a bit string of width I with precisely those bits set that are specified in L, a list of indices.

conj

{BitString.conj +BitString1 +BitString2 ?BitString3}

returns the bitwise ``and'' of its first and second arguments, which must be of indentical widths.

disj

{BitString.disj +BitString1 +BitString2 ?BitString3}

returns the bitwise ``or'' of its first and second arguments, which must be of indentical widths.

nega

{BitString.nega +BitString1 ?BitString2}

returns the bitwise negation of its first argument.

get

{BitString.get +BitString +I ?B}

tests whether bit I of BitString is set.

put

{BitString.put +BitString1 +I +B ?BitString2}

returns a new bit string which is identical to BitString1 except that bit I is set iff B is true.

width

{BitString.width +BitString ?I}

returns the width of the BitString.

toList

{BitString.toList +BitString ?L}

returns the list of indices of all set bits in BitString.


Denys Duchier, Leif Kornstaedt and Christian Schulte
Version 1.4.0 (20080702)