chickadee » srfi-151 » bitwise-fold

bitwise-fold proc seed iprocedure

For each bit b of i from bit #0 (inclusive) to bit (integer-length i) (exclusive), proc is called as (proc b r), where r is the current accumulated result. The initial value of r is seed, and the value returned by proc becomes the next accumulated result. When the last bit has been processed, the final accumulated result becomes the result of bitwise-fold.

  (bitwise-fold cons '() #b1010111) => (#t #f #t #f #t #t #t)