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

[REBOL] Re: Quickest way home using bitsets...

From: rebol-list2:seznam:cz at: 23-Oct-2003 13:39

Hello Rebolinth, Tuesday, October 14, 2003, 10:10:42 PM, you wrote: R> Hello All, R> After discovering the world of bitsets (they must have eaten Kellogs that morning at rebol ;-) R> I was wondering how crispy it could get? R> What im trying to accomplish is to reverse a bitset! R> Or better.. to extract to complete contence from a bitset! R> Bitsets are pritty hard on the mind and thow should not work on it all day :-) R> ..Still i was not able to lauch a trick to do a reverse bitset.. R> Assume this is the bitset: R> make bitset! #{ R> 00000000010000000000000032D19C0000000000000000000000000000000000 R> } R> How do i get back its contents? Shifting my way back through all 256 bits? R> I cant believe thats the only way to do it...uhum.. R> For those who dont know how bitsets work: R> a bitset is always a multiply of length? 8 (they all go by eight those little drawfs..) R> dwarf: make bitset! 8 will become #{00} R> To be able to insert some dwarfs in the bitset you can use 'insert like: R> insert dwarf 0 (that is, dwarf 0 is the smalest and 7 is the talest in a range of 8 dwarfs..) R> will result in #{01} R> insert dwarf 7 (after inserting a 1 into the dwarf..will become) #{81} R> etc...etc...
>> dwarf: make bitset! 8
== make bitset! #{00} ;is something like: 2#{00000000}
>> insert dwarf 0
== make bitset! #{01} ;is something like: 2#{00000001} this seems to be a bug to me... send it to the feedback It looks that now there is used 0 for first bit. You can use only range 0 - 7 to set bits in this bitset it should be 1 - 8 to be more consistent, but who use it anyway? It's used only for parsing (charset is only shortcut for bitset) -- Best regards, rebOldes -----------------[ http://oldes.multimedia.cz/ ]