summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index d279ece8..3aed7b58 100644
--- a/hash.c
+++ b/hash.c
@@ -1149,6 +1149,22 @@ val hash_update_1(val hash, val key, val fun, val init)
}
}
+val hash_revget(val hash, val value, val test, val keyfun)
+{
+ val iter = hash_begin(hash);
+ val cell;
+
+ test = default_arg(test, eql_f);
+ keyfun = default_arg(keyfun, identity_f);
+
+ while ((cell = hash_next(iter)) != nil) {
+ if (funcall2(test, value, funcall1(keyfun, cdr(cell))))
+ return car(cell);
+ }
+
+ return nil;
+}
+
void hash_init(void)
{
weak_keys_k = intern(lit("weak-keys"), keyword_package);