- copy-bit index i booleanprocedure
Returns an integer the same as i except in the indexth bit, which is 1 if boolean is #t and 0 if boolean is #f.
Compatibility note: The R6RS analogue bitwise-copy-bit as originally documented has a completely different interface. (bitwise-copy-bit dest index source) replaces the index'th bit of dest with the index'th bit of source. It is equivalent to (bit-field-replace-same dest source index (+ index 1)). However, an erratum made a silent breaking change to interpret the third argument as 0 for a false bit and 1 for a true bit. Some R6RS implementations applied this erratum but others did not.
(copy-bit 0 0 #t) => #b1 (copy-bit 2 0 #t) => #b100 (copy-bit 2 #b1111 #f) => #b1011