Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Temporal data [was is REBOL OO]

From: SunandaDH:aol at: 14-Jan-2004 13:21

Hi Gabriele,
> Well, since we're talking 356 bits, maybe you'll forgive me > wasting some memory. > > >> bitmap: "000110101000111111100101001111111" ;... till 356 days > == "000110101000111111100101001111111" > >> available?: func [bitmap cons] [if bitmap: find bitmap head insert/dup > clear "" 1 cons [index? bitmap]]
Thanks for the reply. That's a neat bit of lateral thinking! You correctly spotted that Puzzle 2 was a trick question to highlight the inadequacies of using REBOL's bitmaps for binary strings longer than 32 octets -- so that some other sort of representation was needed. A "character bitmap" (to coin a term) of the sort you use, obviously lifts a binary string into a realm in which various standard REBOL operations are possible -- like finding the longest sequence of 1s, reversing the string etc. And it makes possible things that REBOL doesn't properly support like shift/left or rotate/right But it makes it much harder (I won't say impossible, or someone will email in a char-xor function) to do boolean operations. I guess a system that needs to do basic boolean operations on binary strings could do those directly, and then unfurl (to coin another term) the binary string into a character bitmap for those other operations. Provided furling and unfurling was fast, it could work. Ideally, though, REBOL would provide a wider ranger of ways to work with bits. (Another alternative is to write the operations in C or asm and use /Pro or /command. But that makes portability a pain) Thanks again, Sunanda.<