diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-01-17 06:15:31 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-01-17 06:15:31 -0800 |
commit | 895c236f70ecc3b0fbb04eab7d1330796e0610e6 (patch) | |
tree | f2d1b49ddaf378b5c5136f0e59b2bd08aa171c9e /stdlib | |
parent | 0708c9a12a1bc518046d9882b7d365b6c5626e76 (diff) | |
download | txr-895c236f70ecc3b0fbb04eab7d1330796e0610e6.tar.gz txr-895c236f70ecc3b0fbb04eab7d1330796e0610e6.tar.bz2 txr-895c236f70ecc3b0fbb04eab7d1330796e0610e6.zip |
New macro: lop1.
* autoload.c (op_set_entries): Autoload on lop1 symbol.
* stldlib/op.tl (sys:op-expand): Add lop1 case.
(sys:opip-expand): Add lop1 to the list of operators
that are recgonized and specially treated.
(lop1): New macro.
* tests/012/op.tl: New tests.
* txr.1: Documented.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/op.tl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/stdlib/op.tl b/stdlib/op.tl index a3a0135e..b443a2d2 100644 --- a/stdlib/op.tl +++ b/stdlib/op.tl @@ -172,6 +172,13 @@ ;; no cadr here to avoid circular autoload ^[sys:apply ,(car (cdr syntax-2)) (append ,rest-sym (list ,*fargs-l1))])) + ((and (eq sym 'lop1) fargs) + (let ((fargs-l1 (mapcar (lambda (farg) + ^(sys:l1-val ,farg)) + fargs)) + (arg1 (sys:ensure-op-arg ctx 1))) + ;; no cadr here to avoid circular autoload + ^[,(car (cdr syntax-2)) ,arg1 ,*fargs-l1])) (metas syntax-2) ((eq sym 'do) (let ((arg1 (sys:ensure-op-arg ctx 1))) @@ -199,6 +206,9 @@ (defmacro lop (:form f :env e . args) (sys:op-expand f e args)) +(defmacro lop1 (:form f :env e . args) + (sys:op-expand f e args)) + (defmacro ldo (op . args) ^(do ,op @1 ,*args)) @@ -243,7 +253,7 @@ (cons c (sys:opip-expand e opsym dosym rest)) (let ((sym (car c))) (cond - ((memq sym '(dwim uref qref op do lop ldo ap ip ado ido ret aret)) + ((memq sym '(dwim uref qref op do lop lop1 ldo ap ip ado ido ret aret)) (cons c (sys:opip-expand e opsym dosym rest))) ((sys:opip-single-let-p c) (tree-bind (t sym) c |