Next Previous Up Top Contents Index

1.4 Language differences

table-protocol

Open generic function

Summary

Returns functions used to implement the iteration protocol for tables.

Signature

table-protocol table => test-function hash-function 

Arguments

table
An instance of <table>.

Values

test-function
An instance of <function>.

hash-function
An instance of <function>.

Library

dylan

Module

dylan

Description

Returns the functions used to iterate over tables. These functions are in turn used to implement the other collection operations on <table>.

The test-function argument is for the table test function, which is used to compare table keys. It returns true if, according to the table's equivalence predicate, the keys are members of the same equivalence class. Its signature must be:

  test-function key1 key2 => boolean 

The hash-function argument is for the table hash function, which computes the hash code of a key. Its signature must be:

  hash-function key initial-state => id result-state 

In this signature, initial-state is an instance of <hash-state>. The hash function computes the hash code of key, using the hash function that is associated with the table's equivalence predicate. The hash code is returned as two values: an integer id and a hash-state result-state. This result-state is obtained by merging the initial-state with the hash-state that results from hashing key. The result-state may or may not be == to initial-state. The initial-state could be modified by this operation.


Common Dylan and Functional Extensions - 31 Mar 00

Next Previous Up Top Contents Index