Interval sets


The interval-sets vocabulary implements an efficient data structure for sets of positive, machine word-sized integers, specified by ranges. The space taken by the data structure is proportional to the number of intervals contained. Membership testing is O(log n), and creation is O(n log n), where n is the number of ranges. Boolean operations are O(n). Interval sets are immutable.
interval-set

<interval-set> ( specification -- interval-set )

in? ( key set -- ? )

<interval-not> ( set maximum -- set' )

<interval-and> ( set1 set2 -- set )

<interval-or> ( set1 set2 -- set )