[REBOL] Re: Quickest way home using bitsets...
From: brett:codeconscious at: 15-Oct-2003 10:15
Hi Norman and Gregg,
> R> What im trying to accomplish is to reverse a bitset!
Grab a silver backed piece of glass and hold it close to your monitor -
voila! a bitset reversed!
Series! are an ordered sequence of items. Conceptually, Bitset! does not
record a sequence, it records set membership, but it does assign an index
number to individual bits. So you cannot reverse a bitset like you can
reverse a series.
If you decide to imply that your bitset has a sequence using your own
conventions, then to reverse the bitset you will have to convert it into a
series, reverse that and convert that back to a bitset.
> R> Or better.. to extract to complete contence from a bitset!
>
> I think Brett(?) had a module that did that, but I'm not sure where it
> is. I might have it here somewhere if nobody else knows.
I have an old script on my website but it uses the iteration method which
Norman is trying to avoid.
Norman, be warned, the following will encourage your "wandering again off
the path":
>> enbase/base load at mold insert make bitset! 16 1 14 2
== "0000001000000000"
>> enbase/base load at mold insert make bitset! 16 2 14 2
== "0000010000000000"
>> enbase/base load at mold insert make bitset! 16 8 14 2
== "0000000000000001"
Brett.