Nov-30-2017, 02:17 AM
in English, the plural form of range is ranges. i'm looking for a class that supports more than one range. an instance of such a class should start empty and have a default value (can be specified or be None if not specified). i then add range 2,3.5 to have a value of 'foo'. i then add range 4.5,6 to have a value of 'bar'. i then lookup 4.75 and get 'bar'. i then delete range 3,5. i repeat lookup 4.75 and now i get the default value. so delete is just a case of adding a range of the default value. this is a "flat" range container.
a "stack" range container would return a list of values based on the inserts being stacked over and the lookup seeing the stack. so in the above i would get [None, 'bar', None]. a special smash function would mash down everything in the range specified so that if range 3,5 is smashed (a true delete) then looking up 4.75 returns [None].
there would also be network address variants of those that can be optimized and support high speed route tables.
maybe these have already been done?
a "stack" range container would return a list of values based on the inserts being stacked over and the lookup seeing the stack. so in the above i would get [None, 'bar', None]. a special smash function would mash down everything in the range specified so that if range 3,5 is smashed (a true delete) then looking up 4.75 returns [None].
there would also be network address variants of those that can be optimized and support high speed route tables.
maybe these have already been done?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.