summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-01-24 07:30:00 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-01-24 07:30:00 -0800
commit24f50b052eb8f8fe3a37d60d0a9e6daebab7f84a (patch)
tree69b708e12a8cff8a2c100e0b8e76d84a93fa7c80 /hash.c
parent21ecebc20e45132bd1c78fd5392b5f6523e4c9e6 (diff)
downloadtxr-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.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 21168c0c..9befedab 100644
--- a/hash.c
+++ b/hash.c
@@ -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);