Jump to content

Associative array/Creation: Difference between revisions

Line 1,074:
{{trans|Scheme}}
{{libheader|xxHash}}
The following implementation includes set and get, and also "generators", which are like iterators except they are closures rather than regular objects. You need the xxHash C library. (I have written an implementation of SpookyHash in ATS, but the xxHash C library works fine, as well.)
 
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>(*------------------------------------------------------------------*)
 
1,448

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.