]> gitweb.factorcode.org Git - factor.git/blob - basis/interval-maps/interval-maps-docs.factor
Fix permission bits
[factor.git] / basis / interval-maps / interval-maps-docs.factor
1 USING: help.markup help.syntax ;\r
2 IN: interval-maps\r
3 \r
4 HELP: interval-at*\r
5 { $values { "key" "an object" } { "map" "an interval map" } { "value" "the value for the key, or f" } { "?" "whether the key is present" } }\r
6 { $description "Looks up a key in an interval map, returning the corresponding value if the item is in an interval in the map, and a boolean flag. The operation takes O(log n) time." } ;\r
7 \r
8 HELP: interval-at\r
9 { $values { "key" "an object" } { "map" "an interval map" } { "value" "the value for the key, or f" } }\r
10 { $description "Looks up a key in an interval map, returning the value of the corresponding interval, or f if the interval is not present in the map." } ;\r
11 \r
12 HELP: interval-key?\r
13 { $values { "key" "an object" } { "map" "an interval map" } { "?" "a boolean" } }\r
14 { $description "Tests whether an object is in an interval in the interval map, returning t if the object is present." } ;\r
15 \r
16 HELP: <interval-map>\r
17 { $values { "specification" "an assoc" } { "map" "an interval map" } }\r
18 { $description "From a specification, produce an interval tree. The specification is an assoc where the keys are intervals, or pairs of numbers to represent intervals, or individual numbers to represent singleton intervals. The values are the values int he interval map. Construction time is O(n log n)." } ;\r
19 \r
20 ARTICLE: "interval-maps" "Interval maps"\r
21 "Interval maps are a mechanism, 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."\r
22 "The following operations are used to query interval maps:"\r
23 { $subsection interval-at* }\r
24 { $subsection interval-at }\r
25 { $subsection interval-key? }\r
26 "Use the following to construct interval maps"\r
27 { $subsection <interval-map> } ;\r
28 \r
29 ABOUT: "interval-maps"\r