[REBOL] Re: Temporal data [was is REBOL OO]
From: greggirwin:mindspring at: 14-Jan-2004 13:25
Sunanda et al
Sac> 256 bits isn't enough for a bit-per-day for a whole year. We need
Sac> two bitmaps.
You can do it with one.
bitset: make bitset! 368
loop 200 [insert bitset random 367]
s: copy ""
repeat i 368 [append s to integer! find bitset i - 1]
print s
available?: func [bitset len] [
mark: 1 count: 0
repeat i subtract length? bitset 1 [
either find bitset i [
count: count + 1
if count >= len [return mark]
][mark: i + 2 count: 0]
; The + 2 accounts for bitsets having a 0 base
; and the mark being set to the next bit.
]
]
repeat i 6 [print available? bitset i]
-- Gregg