diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-06-23 22:22:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-06-23 22:22:13 -0700 |
commit | e65fc7cc213436bba321a9b616bb77874b2a789a (patch) | |
tree | a1f6c1ca19b1aa1d865e2a985b14d0ec093f1a1c /txr.1 | |
parent | 742b9e4d64a178578476894636bf94911738d957 (diff) | |
download | txr-e65fc7cc213436bba321a9b616bb77874b2a789a.tar.gz txr-e65fc7cc213436bba321a9b616bb77874b2a789a.tar.bz2 txr-e65fc7cc213436bba321a9b616bb77874b2a789a.zip |
Hash subset testing.
* eval.c (eval_init): Register hash-subset and hash-proper-subset
intrinsics.
* hash.c (hash_subset, hash_proper_subset): New functions.
* hash.h (hash_subset, hash_proper_subset): Declared.
* txr.1: New functions documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 48 |
1 files changed, 48 insertions, 0 deletions
@@ -22348,6 +22348,54 @@ and it is called with two arguments: the respective data items. The return value is then used as the data item in the intersection hash. +.coNP Functions @ hash-subset and @ hash-proper-subset +.synb +.mets (hash-subset < hash1 << hash2 ) +.mets (hash-proper-subset < hash1 << hash2 ) +.syne +.desc +The +.code hash-subset +function returns +.code t +if the keys in +.meta hash1 +are a subset of the keys in +.metn hash2 . + +The +.code hash-proper-subset +function returns +.code t +if the keys in +.meta hash1 +are a proper subset of the keys in +.metn hash2 . +This means that +.meta hash2 +has all the keys which are in +.meta hash1 +and at least one which isn't. + +Note: the return value may not be mathematically meaningful if +.meta hash1 +and +.meta hash2 +use different equality. In any case, the actual behavior +may be understood as follows. The implementation of +.code hash-subset +tests whether each of the keys in +.meta hash1 +occurs in +.meta hash2 +using their respective equalities. +The implementation of +.code hash-proper-subset +applies +.code hash-subset +first, as above. If that is true, and the two hashes have the same number of +elements, the result is falsified. + .SS* Partial Evaluation and Combinators .coNP Macros @ op and @ do .synb |