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 zero-based index.

They are displayed as a sequence of 0s and 1s prefixed by #*, e.g.,

(make-uniform-vector 8 #t #f) =>

#b(#t #f #t) =>

bit-count b bitvector Scheme Procedure
scm_bit_count (b, bitvector) C Function
Return the number of occurrences of the boolean b in bitvector.

bit-position 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.

bit-invert! v Scheme Procedure
scm_bit_invert_x (v) C Function
Modify bv by replacing each element with its negation.

bit-set*! v kv obj Scheme Procedure
scm_bit_set_star_x (v, kv, obj) C Function
If uve is a bit-vector 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.

bit-count* v kv obj Scheme Procedure
scm_bit_count_star (v, kv, obj) C Function
(bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).
bv is not modified.