diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-07-16 06:49:52 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-07-16 06:49:52 -0700 |
commit | 32c00ceb3724fb831d666e8bbdc15ad826161731 (patch) | |
tree | b7f77d6131c9fa2018321bde17d3707b7681f848 /share | |
parent | ea817f07f716a712f239152a0a10813c8aa4788e (diff) | |
download | txr-32c00ceb3724fb831d666e8bbdc15ad826161731.tar.gz txr-32c00ceb3724fb831d666e8bbdc15ad826161731.tar.bz2 txr-32c00ceb3724fb831d666e8bbdc15ad826161731.zip |
opip, oand: rewrite in Lisp.
* eval.c (opip_s, oand_s, chain_s, chand_s): Variables
removed.
(me_opip): Function removed.
(eval_init): Initializations of removed variables removed.
chain and chand symbols interned at point of function
registration.
* lisplib.c (op_set_entries): Add autoload entries for opip
and oand.
* share/txr/stdlib/op.tl (sys:opip-expand): New function.
(opip, oand): New macros.
* protsym.c: Regenerated.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/op.tl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/share/txr/stdlib/op.tl b/share/txr/stdlib/op.tl index 2457a096..b3b3a74b 100644 --- a/share/txr/stdlib/op.tl +++ b/share/txr/stdlib/op.tl @@ -123,3 +123,20 @@ (defmacro aret (. args) ^(ap identity (progn @rest ,*args))) + +(defun sys:opip-expand (e clauses) + (collect-each ((c clauses)) + (if (atom c) + c + (let ((sym (car c))) + (if (member sym '(dwim uref qref)) + c + (let ((opdo (if (or (special-operator-p (car c)) + (macro-form-p c e)) 'do 'op))) + ^(,opdo ,*c))))))) + +(defmacro opip (:env e . clauses) + ^[chain ,*(sys:opip-expand e clauses)]) + +(defmacro oand (:env e . clauses) + ^[chand ,*(sys:opip-expand e clauses)]) |