diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-05-15 07:41:19 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-05-15 07:41:19 -0700 |
commit | c606261b92348ef7b0f934705ee46ee4ccf28bab (patch) | |
tree | 384d5448080b423bf4ff72b455eb368176f74edb /tests/019 | |
parent | a500d048021a018800ed28f23509800f6b45bf6f (diff) | |
download | txr-c606261b92348ef7b0f934705ee46ee4ccf28bab.tar.gz txr-c606261b92348ef7b0f934705ee46ee4ccf28bab.tar.bz2 txr-c606261b92348ef7b0f934705ee46ee4ccf28bab.zip |
New special operator: progv
Adding a progv operator, similar to the Common Lisp one.
* eval.c (progv_s): New symbol variable.
(op_progv): New static function.
(do_expand): Recognize and traverse the progv form.
(rt_progv): New static function: run-time support
for compiled progv.
(eval_init): Initialize progv_s, and register the the
op_progv operator interpreting function.
* stdlib/compilert (compiler compile): Handle progv
operator ...
(compiler comp-progv): ... via this new method.
* tests/019/progv.tl: New file.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'tests/019')
-rw-r--r-- | tests/019/progv.tl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/019/progv.tl b/tests/019/progv.tl new file mode 100644 index 00000000..7ab3aafe --- /dev/null +++ b/tests/019/progv.tl @@ -0,0 +1,29 @@ +(load "../common") + +(defvar a 42) +(defvar b 73) + +(mtest + (progv '(a) '(1) a) 1 + (progv '(a b) '(1 2) (cons a b)) (1 . 2) + (progv '(x) '(1) (let ((x 4)) (symbol-value 'x))) 1) + +(let ((n (list 'a 'b)) + (v (list 1 2))) + (mtest + (progv n v (cons a b)) (1 . 2))) + +(defvarl x) + +(let ((x 'lexical) + (vars (list 'x)) + (vals (list 'dynamic))) + (test + (progv vars vals (list x (symbol-value 'x))) + (lexical dynamic))) + +(compile-only + (eval-only + (with-compile-opts (nil unused) + (compile-file (base-name *load-path*) "temp.tlo")) + (remove-path "temp.tlo"))) |