REBOL/Core 2.5.3 bitset! issues
[1/1] from: oliva::david::seznam::cz at: 4-Aug-2002 22:11
Hello Carl,
Saturday, August 3, 2002, 6:08:19 AM, you wrote:
CaR> A new REBOL/Core has been released for testing purposes.
...
CaR> New Bitset Functions: CLEAR, LENGTH?, EMPTY?
...so in the new Rebol we can do:
>> items: make bitset! 8
== make bitset! #{00}
>> insert items 1
== make bitset! #{02}
>> find items 1
== true
>> insert items 0
== make bitset! #{03}
Nice... but what about remove:
>> remove items 0
== make bitset! #{02}
Do I need to clear bitset and set again all other bits just to switch one
bit?
...It would be nice to have posibility (if it would not affect speed
too much) to use paths on bitsets as well:
>> items
== make bitset! #{03}
>> items/1
== true
>> items/7: true
== make bitset! #{83}
>> items/7: false
== make bitset! #{03}
...and what about converting to binary:
>> items
== make bitset! #{03}
>> to-binary items
== #{
031DE1000000000000000000000000000A00E100000000000000000000000000
}
I would like to have:
>> to-binary items
== #{03}
and:
>> join #{} items
== #{6D616B65206269747365742120237B30337D}
should be #{03} as well
BUT it's nice to see that there is some progress so we will not need to
do these (slow) operations in the future (hope):
>> flags: enbase/base #{03} 2
== "00000011"
>> flags/8: #"1"
== "00000011"
>> if flags/8 = #"1" [flags/8: #"0"]
== "00000010"
>> flags: debase/base flags 2
== #{02}
Thanks for response... Oldes