Associative array/Creation: Difference between revisions
Content added Content deleted
Line 1,074: | Line 1,074: | ||
{{trans|Scheme}} |
{{trans|Scheme}} |
||
{{libheader|xxHash}} |
{{libheader|xxHash}} |
||
The following implementation includes set and get, and also "generators", which are like iterators except they are closures rather than regular objects. |
The following implementation includes set and get, and also "generators", which are like iterators except they are closures rather than regular objects. |
||
To run this demonstration you need the [http://www.example.com xxHash] C library. I have written an implementation of SpookyHash in ATS, but using a C library is fine, and requires less ATS code. |
|||
Because the hash table is an AVL tree, performance will tend to be logarithmic. This assumes a good hash function, of course. With a bad hash function, performance may be linear. |
|||
<lang ATS>(*------------------------------------------------------------------*) |
<lang ATS>(*------------------------------------------------------------------*) |
||