Go to the first, previous, next, last section, table of contents.


makeIndex

Function: makeIndex
file: job.t
package: muf
status: alpha

The makeIndex function creates and returns an instance of Class Index which will keep key-val pairs in sorted btrees (as opposed to objects made by makeHash, which stores key-val pairs in a hashed btree. The two types of objects are in all other respects identical.

Indices objects are useful when you wish to iterate over all keys in natural order, rather than the random-looking order produced by hashed btrees. (For a more extended discussion of the tradeoffs: See section low-level MOS functions.)

Stack:
makeIndex --> datebook
Stack:
"555-1212 -- cute" --> datebook["kim"]
Stack:
"555-2121 -- never again" --> datebook["pat"]
Stack:
datebook foreach key val do{ [ "%s: %s\n" key val | ]print , }

See section makeHash.


Go to the first, previous, next, last section, table of contents.