diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-01-24 07:30:00 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-01-24 07:30:00 -0800 |
commit | 24f50b052eb8f8fe3a37d60d0a9e6daebab7f84a (patch) | |
tree | 69b708e12a8cff8a2c100e0b8e76d84a93fa7c80 /hash.c | |
parent | 21ecebc20e45132bd1c78fd5392b5f6523e4c9e6 (diff) | |
download | txr-24f50b052eb8f8fe3a37d60d0a9e6daebab7f84a.tar.gz txr-24f50b052eb8f8fe3a37d60d0a9e6daebab7f84a.tar.bz2 txr-24f50b052eb8f8fe3a37d60d0a9e6daebab7f84a.zip |
* hash.c (hash_update): New function.
* hash.h (hash_update): Declared.
* lib.c (update): New function.
* lib.h (update): Declared.
* eval.c (eval_init): Register hash_update and update as intrinsics.
* txr.1: Documented.
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -858,6 +858,15 @@ val hash_isec(val hash1, val hash2) } } +val hash_update(val hash, val fun) +{ + val iter = hash_begin(hash); + val cell; + while ((cell = hash_next(iter)) != nil) + rplacd(cell, funcall1(fun, cdr(cell))); + return hash; +} + void hash_init(void) { weak_keys_k = intern(lit("weak-keys"), keyword_package); |