diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-02-11 17:41:48 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-02-11 17:41:48 -0800 |
commit | ef33ae0c563543449d2284e13d6c9ba28654e64d (patch) | |
tree | eaa35be8bf1bbc90afea1d56e6f7407aa54a8c4e /txr.1 | |
parent | e9ebac341d45521b4558a4d198129484ef094a8e (diff) | |
download | txr-ef33ae0c563543449d2284e13d6c9ba28654e64d.tar.gz txr-ef33ae0c563543449d2284e13d6c9ba28654e64d.tar.bz2 txr-ef33ae0c563543449d2284e13d6c9ba28654e64d.zip |
Add rassoc and rassql functions.
* eval.c (eval_init): Register rassoc and rassql intrinsics.
* lib.c (rassoc, rassql): New functions.
* lib.h (rassoc, rassql): Declared.
* txr.1: Documented rassoc and rassql, with small fixes
to assql and assoc.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 53 |
1 files changed, 50 insertions, 3 deletions
@@ -18072,10 +18072,13 @@ The function searches an association list .meta alist for a cons cell whose -car field is equivalent to +.code car +field is equivalent to .meta key -(with equality determined by the equal -function). The first such cons is returned. If no such cons is found, +under the +.code equal +function. +The first such cons is returned. If no such cons is found, .code nil is returned. @@ -18094,6 +18097,50 @@ is determined using the function rather than .codn equal . +.coNP Functions @ rassql and @ rassoc +.synb +.mets (rassql < value << alist ) +.mets (rassoc < value << alist ) +.syne +.desc +The +.code rassql +and +.code rassoc +functions are reverse lookup counterparts to +.code assql +and +.codn assoc . +When searching, they examine the +.code cdr +field of the pairs of +.meta alist +rather than the +.code car +field. + +The +.code rassql +function searches association list +.meta alist +for a cons whose +.code cdr +field equivalent to +.meta value +according to the +.code eql +function. If such a cons is found, it is returned. +Otherwise +.code nil +is returned. + +The +.code rassoc +function searches in the same way as +.code rassql +but compares values using +.codn equal . + .coNP Function @ acons .synb .mets (acons < car < cdr << alist ) |