| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A range table is a table that efficiently associates values with ranges of fixnums.
Note that range tables have a read syntax, like this:
#s(range-table type start-closed-end-open data ((-3 2) foo (5 20) bar)) |
This maps integers in the range [-3, 2) to foo and integers
in the range [5, 20) to bar.
By default, range tables have a type of
start-closed-end-open. (NOTE: This is a change from
21.4 and earlier, where there was no type and range tables were always
closed on both ends.) This makes them work like text properties.
nil if object is a range table.
| 54.1 Introduction to Range Tables | Range tables efficiently map ranges of integers to values. | |
| 54.2 Working With Range Tables | Range table functions. |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
type is a symbol indicating how ranges are assumed to function at their ends. It can be one of
SYMBOL RANGE-START RANGE-END ------ ----------- --------- `start-closed-end-open' (the default) closed open `start-closed-end-closed' closed closed `start-open-end-open' open open `start-open-end-closed' open closed |
A closed endpoint of a range means that the number at that end is included in the range. For an open endpoint, the number would not be included.
For example, a closed-open range from 5 to 20 would be indicated as `[5, 20)' where a bracket indicates a closed end and a parenthesis an open end, and would mean `all the numbers between 5 and 20', including 5 but not 20. This seems a little strange at first but is in fact extremely common in the outside world as well as in computers and makes things work sensibly. For example, if I say "there are seven days between today and next week today", I'm including today but not next week today; if I included both, there would be eight days. Similarly, there are 15 (= 20 - 5) elements in the range `[5, 20)', but 16 in the range `[5, 20]'.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
nil).
NOTE: If you are working with ranges that are closed at the
start and open at the end (the default), and you put a value for a
range with start equal to end, get-range-table will
not return that value! You would need to set end one
greater than start.
NOTE: Unless you are working with ranges that are closed at both ends, nothing will happen if start equals end.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |