Skip to content

Instantly share code, notes, and snippets.

@hostilefork
Created January 13, 2013 21:17
Show Gist options
  • Save hostilefork/4526253 to your computer and use it in GitHub Desktop.
Save hostilefork/4526253 to your computer and use it in GitHub Desktop.
Demonstration of problem in R3 with PARSE vs. FIND on varied bitsets, circa commit a6077e8
;-- Test the low range...
>> low: charset [#"^(00)" - #"^(80)"]
== make bitset! #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80}
>> find low #{40}
== true
>> find low #{A0}
== none
>> parse #{40} [low]
== true
>> parse #{A0} [low]
== false
;-- Test the high range...
>> high: charset [#"^(81)" - #"^(FF)"]
== make bitset! #{000000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
>> find high #{40}
== none
>> find high #{A0}
== true
>> parse #{40} [high]
== false
>> parse #{A0} [high]
== true
;-- Test the low range...
>> mid: charset [#"^(40)" - #"^(A0)"]
== make bitset! #{0000000000000000FFFFFFFFFFFFFFFFFFFFFFFF80}
>> find mid #{20}
== none
>> find mid #{C0}
== none
>> find mid #{80}
== true
>> parse #{20} [mid]
== false
>> parse #{C0} [mid]
== false
>> parse #{80} [mid]
== true
;-- Now we just try some wacky range, which demonstrates an
;-- inconsistency between parse and find on bitsets...
>> misc: charset [#"^(C2)" - #"^(DF)"]
== make bitset! #{0000000000000000000000000000000000000000000000003FFFFFFF}
>> find misc #{E4}
== none
>> parse #{E4} [misc]
== true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment