summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-04 08:37:51 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-04 08:37:51 -0700
commit4ecca7c0b2ac3d61658d749f51dc1e7fbc408ed8 (patch)
tree7d53e099bd63c1546eb91bb41eac2700b2ada339 /txr.1
parent7b226277f9ab1d27c657e80e4a44c43c0bedf002 (diff)
downloadtxr-4ecca7c0b2ac3d61658d749f51dc1e7fbc408ed8.tar.gz
txr-4ecca7c0b2ac3d61658d749f51dc1e7fbc408ed8.tar.bz2
txr-4ecca7c0b2ac3d61658d749f51dc1e7fbc408ed8.zip
* hash.c (hash_revget): New function.
* hash.h (hash_revget): Declared. * eval.c (eval_init): Registered hash-revget intrinsic. * txr.1: Documented hash-revget.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.144
1 files changed, 44 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index a1ff068b..19984c25 100644
--- a/txr.1
+++ b/txr.1
@@ -25301,6 +25301,50 @@ to
The function returns
.codn nil .
+.coNP Function @ hash-revget
+.synb
+.mets (hash-revget < hash < value >> [ testfun <> [ keyfun ]])
+.syne
+.desc
+The
+.code hash-revget
+function performs a reverse lookup on
+.metn hash .
+
+It searches through the entries stored in
+.meta hash
+for an entry whose value matches
+.metn value .
+
+If such an entry is found, that entry's key is returned.
+Otherwise
+.code nil
+is returned.
+
+If multiple matching entries exist, it is not specified which entry's
+key is returned.
+
+The
+.meta keyfun
+function is applied to each value in
+.meta hash
+and the resulting value is compared with
+.metn value .
+The default
+.meta keyfun
+is the
+.code identity
+function.
+
+The comparison is performed using
+.metn testfun .
+
+The default
+.meta testfun
+is the
+.code eql
+function.
+
.coNP Functions @ hash-eql and @ hash-equal
.synb
.mets (hash-eql << object )