From a6decf49b7c58f29670c1620ce1aecf5d0aa2cad Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 22 Jan 2021 00:31:42 -0800 Subject: hash: hash-revget now defaults to equal. * hash.c (hash_revget): Default to equal, except in compatibility mode. (hash_keys_of): Also default to equal. This function is too new to bother with compatibility switching. * txr.1: Documented, with compat notes. --- hash.c | 8 ++++++-- txr.1 | 11 ++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/hash.c b/hash.c index 8040fa68..1cbc8285 100644 --- a/hash.c +++ b/hash.c @@ -1797,7 +1797,11 @@ val hash_revget(val hash, val value, val test, val keyfun) hash_iter_init(&hi, hash, self); - test = default_arg(test, eql_f); + if (opt_compat && opt_compat <= 248) + test = default_arg(test, eql_f); + else + test = default_arg(test, equal_f); + keyfun = default_arg(keyfun, identity_f); while ((cell = hash_iter_next(&hi)) != nil) { @@ -1817,7 +1821,7 @@ val hash_keys_of(val hash, val value, val test, val keyfun) hash_iter_init(&hi, hash, self); - test = default_arg(test, eql_f); + test = default_arg(test, equal_f); keyfun = default_arg(keyfun, identity_f); while ((cell = hash_iter_next(&hi)) != nil) { diff --git a/txr.1 b/txr.1 index 45800d08..4033359a 100644 --- a/txr.1 +++ b/txr.1 @@ -48421,7 +48421,7 @@ The comparison is performed using The default .meta testfun is the -.code eql +.code equal function. .coNP Function @ hash-invert @@ -76742,6 +76742,15 @@ of these version values, the described behaviors are provided if is given an argument which is equal or lower. For instance .code "-C 103" selects the behaviors described below for version 105, but not those for 102. +.IP 248 +Until \*(TX 248, the +.code hash-revget +function defaulted to using +.code eql +equality for searching the hash table for matching values rather than the +current +.codn equal . +A compatibility value of 248 or lower restores the behavior. .IP 244 Until \*(TX 244, the .code env-hash -- cgit v1.2.3