## 9.5 Bit Arrays

The module `BitArray` contains procedures operating on arrays of bits (i. e., units of information each being either set or reset).

`IsBitArray`

  > `{BitArray.is` `+X``` `?B``}`

  tests whether `X` is a bit array.

`new`

  > `{BitArray.new` `+LowI``` `+HighI``` `?BitArray``}`

  creates an new `BitArray` with lower bound `LowI` and upper bound `HighI`, and all bits initially cleared. This interface is identical to that of general Oz arrays.

`set`

  > `{BitArray.set` `+BitArray``` `+I``}`

  sets bit `I` of `BitArray`.

`clear`

  > `{BitArray.clear` `+BitArray``` `+I``}`

  clears bit `I` of `BitArray`.

`test`

  > `{BitArray.test` `+BitArray``` `+I``` `?B``}`

  tests whether bit `I` of `BitArray` is set.

`low`

  > `{BitArray.low` `+BitArray``` `?LowI``}`

  returns the lower bound `LowI` of `BitArray`.

`high`

  > `{BitArray.high` `+BitArray``` `?HighI``}`

  returns the upper bound `HighI` of `BitArray`.

`clone`

  > `{BitArray.clone` `+BitArray1``` `?BitArray2``}`

  returns a new bit array that is a copy of its first argument.

`disj`

  > `{BitArray.disj` `+BitArray1``` `+BitArray2``}`

  side-effects its first argument with the bitwise ``or'' of the two arguments.

`conj`

  > `{BitArray.conj` `+BitArray1``` `+BitArray2``}`

  side-effects its first argument with the bitwise ``and'' of the two arguments.

`nimpl`

  > `{BitArray.nimpl` `+BitArray1``` `+BitArray2``}`

  side-effects its first argument with the bitwise ``and'' of the the first argument and the negation of the second argument (i. e., negated implication).

`disjoint`

  > `{BitArray.disjoint` `+BitArray1``` `+BitArray2``` `?B``}`

  tests whether the bit arrays have no set bits in common.

`card`

  > `{BitArray.card` `+BitArray``` `?I``}`

  returns the number of set bits.

`toList`

  > `{BitArray.toList` `+BitArray``` `?L``}`

  returns the list of indices for all set bits in `BitArray`.

`complementToList`

  > `{BitArray.complementToList` `+BitArray``` `?L``}`

  returns the list of indices for all cleared bits in `BitArray`.