summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kyheku <kaz@kylheku.com>2020-02-24 23:03:08 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-02-24 23:03:08 -0800
commit0e3c047c3fa3ef7d3e7168314bf6fdb0ba15443d (patch)
treeef7aa64fa706ae84f823cb725b63c4b91b4be4b5 /tests
parent3830cf321258321719865709081a709c97fd4e0a (diff)
downloadtxr-0e3c047c3fa3ef7d3e7168314bf6fdb0ba15443d.tar.gz
txr-0e3c047c3fa3ef7d3e7168314bf6fdb0ba15443d.tar.bz2
txr-0e3c047c3fa3ef7d3e7168314bf6fdb0ba15443d.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/012/ashwin.expected0
-rw-r--r--tests/012/ashwin.tl8
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/012/ashwin.expected b/tests/012/ashwin.expected
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/012/ashwin.expected
diff --git a/tests/012/ashwin.tl b/tests/012/ashwin.tl
new file mode 100644
index 00000000..66226f2c
--- /dev/null
+++ b/tests/012/ashwin.tl
@@ -0,0 +1,8 @@
+(load "../common")
+
+(defvarl a-list '((a . 42) (b . 73)))
+(defvarl key 'a)
+
+(test (cdr (assq key a-list)) 42)
+(test (cdr (assq 'b a-list)) 73)
+(test (cdr (assq 'c a-list)) nil)