Bit arrays


Bit array are a fixed-size mutable sequences (Sequence protocol) whose elements are either t or f. Each element only uses one bit of storage, hence the name.

Bit array words are in the bit-arrays vocabulary.

Bit arrays play a special role in the C library interface; they can be used to pass binary data back and forth between Factor and C. See Passing pointers to C functions.

Bit arrays form a class of objects:
bit-array

bit-array? ( object -- ? )


Creating new bit arrays:
>bit-array ( seq -- bit-array )

<bit-array> ( n -- bit-array )


Efficiently setting and clearing all bits in a bit array:
set-bits ( bit-array -- )

clear-bits ( bit-array -- )


Converting between unsigned integers and their binary representation:
integer>bit-array ( n -- bit-array )

bit-array>integer ( bit-array -- n )


Bit array literal syntax:
?{