From 0e3c047c3fa3ef7d3e7168314bf6fdb0ba15443d Mon Sep 17 00:00:00 2001 From: Kaz Kyheku Date: Mon, 24 Feb 2020 23:03:08 -0800 Subject: New function: assq and rassq. TXR Lisp is henceforth a dialect in which (cdr (assq key a-list)) works exactly as shown, without substitution of assql or assoc. * eval.c (eval_init): Register assq and rassq intrinsics. * lib.c (assq, rassq): New functions. * lib.h (assq, rassq): Declared. * txr.1: Documented. * tests/012/ashwin.tl: New file. * tests/012/ashwin.expected: New file. --- txr.1 | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index ea0f07cf..9ca02f9f 100644 --- a/txr.1 +++ b/txr.1 @@ -20394,28 +20394,35 @@ The first such cons is returned. If no such cons is found, .code nil is returned. -.coNP Function @ assql +.coNP Functions @ assq and @ assql .synb +.mets (assq < key << alist ) .mets (assql < key << alist ) .syne .desc The +.code assq +and .code assql -function is just like +functions are very similar to .codn assoc , -except that the equality test -is determined using the +with the only difference being that they determine equality using, +respectively, the +.code eq +and .code eql -function rather than +functions rather than .codn equal . -.coNP Functions @ rassql and @ rassoc +.coNP Functions @, rassq @ rassql and @ rassoc .synb +.mets (rassq < value << alist ) .mets (rassql < value << alist ) .mets (rassoc < value << alist ) .syne .desc The +.codn rassq , .code rassql and .code rassoc @@ -20432,7 +20439,7 @@ rather than the field. The -.code rassql +.code rassoc function searches association list .meta alist for a cons whose @@ -20440,18 +20447,22 @@ for a cons whose field equivalent to .meta value according to the -.code eql +.code equal 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 rassq +and .code rassql -but compares values using -.codn equal . +functions search in the same way as +.code rassoc +but compares values using, respectively, +.code eq +and +.codn eql . .coNP Function @ acons .synb -- cgit v1.2.3