diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-06-28 20:35:28 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-06-28 20:35:28 -0700 |
commit | 8ee92a458a4b854b4a7e726975c1197be877c500 (patch) | |
tree | e864efd0fb99485c6c0891098854f8d64fc35603 /tests/010 | |
parent | 59478a2944d8f9a06a8481bd2f746ffd7dd764c7 (diff) | |
download | txr-8ee92a458a4b854b4a7e726975c1197be877c500.tar.gz txr-8ee92a458a4b854b4a7e726975c1197be877c500.tar.bz2 txr-8ee92a458a4b854b4a7e726975c1197be877c500.zip |
New function: hash-map.
hash-map converts a function mapping over a sequence
into a hash table.
* hash.[ch] (hash_map): New function.
* tests/010/hash.tl: Test case.
* genman.txr: The hash-map identifier introduces
a hash collision. We have to deal with that somehow now.
(colli): We put the conflicting entries into a new hash called
colli which maps them to an increment value.
(hash-title): Increment the hash code h by the amount
indicated in colli, if the title is found there.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'tests/010')
-rw-r--r-- | tests/010/hash.tl | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/010/hash.tl b/tests/010/hash.tl index 5af8b167..db8f07aa 100644 --- a/tests/010/hash.tl +++ b/tests/010/hash.tl @@ -60,3 +60,6 @@ (let ((items (build (whilet ((cell (hash-next i))) (add (car cell)))))) (test (diff 0..200 items) nil)))) + +(test [hash-map square '(1 2 3)] + #H(() (1 1) (2 4) (3 9))) |