From ff2df257b64111213fd94028d2f18b75ebdee003 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 21 Jun 2021 06:37:50 -0700 Subject: Dubious new functions cxr/cyr. * lib.c (cxr, cyr): New functions. * lib.h (cxr, cyr): Declared. * eval.c (eval_init): Intrinsics cxr and cyr registered. * tests/012/cadr.tl: New file. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated. --- tests/012/cadr.tl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/012/cadr.tl (limited to 'tests/012') diff --git a/tests/012/cadr.tl b/tests/012/cadr.tl new file mode 100644 index 00000000..509590f7 --- /dev/null +++ b/tests/012/cadr.tl @@ -0,0 +1,14 @@ +(load "../common") + +(mtest + (cxr 1 42) 42 + (cxr #b11 '(a . b)) a + (cxr #b10 '(a . b)) b + (cxr #b11000 '(1 2 3 4 5)) 4 + (cyr #b100001 '(1 2 3 4 5)) 5 + (cyr #b1111 '(((a)))) a + (cyr #b111 '(a)) :error) + +(let ((r (range* 0 100))) + (vtest (mapcar (op cyr (succ (expt 2 (succ @1))) r) 0..100) r) + (vtest (mapcar (op cxr (* 3 (expt 2 @1)) r) 0..100) r)) -- cgit v1.2.3