[Next] [Previous] [Up] [Top] [Contents] [Index]

8 Collections

Tables

Tables map arbitrary keys to elements. Table keys may be any object, including complex objects such as strings. All tables are instances of <table>. <table> is the only instantiable subclass of <explicit-key-collection> defined by Dylan. Tables are unstable under iteration.

The iteration protocol for tables is implemented in terms of the function table-protocol. Every concrete subclass of <table> must provide or inherit a method for table-protocol. This function accepts a table as an argument, and returns an equivalence predicate and hash-function, as described below.

The equivalence predicate of a table is used to compare keys. (It is the table's key-test.) The table maps keys that are equivalent under the predicate to the same table element. An equivalence predicate is a boolean function of two arguments that returns true if and only if the arguments are considered to be the same according to some specified criteria. For a function to be used as an equivalence predicate, it must be reflexive, commutative, and transitive. That is, for a function F and any arguments X, Y, and Z in the domain of F, the following must be true:


Dylan Reference Manual - 17 OCT 1995
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker