Interval maps
Factor handbook > The language > Collections

Prev:Disjoint sets
Next:Heaps


The interval-maps vocabulary implements a data structure, similar to assocs, where a set of closed intervals of keys are associated with values. As such, interval maps do not conform to the assoc protocol, because intervals of floats, for example, can be used, and it is impossible to get a list of keys in between.

The following operations are used to query interval maps:
interval-at* ( key map -- value ? )

interval-at ( key map -- value )

interval-key? ( key map -- ? )

interval-values ( map -- values )


Use the following to construct interval maps
<interval-map> ( specification -- map )

coalesce ( alist -- specification )