Node:Bit Vectors,
Previous:Uniform Arrays,
Up:Arrays
22.6.4 Bit Vectors
Bit vectors are a specific type of uniform array: an array of booleans
with a single zerobased index.
They are displayed as a sequence of 0
s and
1
s prefixed by #*
, e.g.,
(makeuniformvector 8 #t #f) =>
#*00000000
#b(#t #f #t) =>
#*101
bitcount b bitvector

Scheme Procedure 
scm_bit_count (b, bitvector)

C Function 
Return the number of occurrences of the boolean b in
bitvector.

bitposition item v k

Scheme Procedure 
scm_bit_position (item, v, k)

C Function 
Return the minimum index of an occurrence of bool in
bv which is at least k. If no bool occurs
within the specified range #f is returned.

bitinvert! v

Scheme Procedure 
scm_bit_invert_x (v)

C Function 
Modify bv by replacing each element with its negation.

bitset*! v kv obj

Scheme Procedure 
scm_bit_set_star_x (v, kv, obj)

C Function 
If uve is a bitvector bv and uve must be of the same
length. If bool is #t , uve is OR'ed into
bv; If bool is #f , the inversion of uve is
AND'ed into bv.
If uve is a unsigned long integer vector all the elements of uve
must be between 0 and the length of bv. The bits
of bv corresponding to the indexes in uve are set to
bool. The return value is unspecified.

bitcount* v kv obj

Scheme Procedure 
scm_bit_count_star (v, kv, obj)

C Function 
Return
(bitcount (bitset*! (if bool bv (bitinvert! bv)) uve #t) #t).
bv is not modified.
