summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stdlib/op.tl2
-rw-r--r--tests/012/op.tl6
-rw-r--r--txr.125
3 files changed, 28 insertions, 5 deletions
diff --git a/stdlib/op.tl b/stdlib/op.tl
index 2754ca0d..1f242745 100644
--- a/stdlib/op.tl
+++ b/stdlib/op.tl
@@ -221,7 +221,7 @@
(if (atom c)
c
(let ((sym (car c)))
- (if (member sym '(dwim uref qref))
+ (if (member sym '(dwim uref qref op do lop ldo ap ip ado ido ret aret))
c
(let ((opdo (if (or (special-operator-p (car c))
(macro-form-p c e)) 'do 'op)))
diff --git a/tests/012/op.tl b/tests/012/op.tl
index 5a789219..aafe0a28 100644
--- a/tests/012/op.tl
+++ b/tests/012/op.tl
@@ -93,3 +93,9 @@
[[[[(do do do op list) 1] 2] 3] 4] (1 2 3 4)
[[[[(do do do op list @1 @@1 @@@1 @@@@1) 1] 2] 3] 4] (4 3 2 1)
[[[[(do do do op list @@@@1 @@@1 @@1 @1) 1] 2] 3] 4] (1 2 3 4))
+
+(test (flow (range 1000 9999)
+ (keep-if (opip digits (ap > (+ @2 @3) (+ @1 @4))))
+ (partition-if (op neq 1 (- @2 @1)))
+ (find-max-key @1 : len))
+ 80)
diff --git a/txr.1 b/txr.1
index 03386c86..b1cf7148 100644
--- a/txr.1
+++ b/txr.1
@@ -56777,16 +56777,31 @@ where the above
notation denotes the following transformation applied to each argument:
.verb
- (function ...) -> (op function ...)
- (operator ...) -> (do operator ...)
- (macro ...) -> (do macro ...)
+ ;; these specific form patterns are left untransformed:
+
(dwim ...) -> (dwim ...)
[...] -> [...]
(qref ...) -> (qref ...)
(uref ...) -> (uref ...)
+ (op ...) -> (op ...)
+ (do ...) -> (do ...)
+ (lop ...) -> (lop ...)
+ (ldo ...) -> (ldo ...)
+ (ap ...) -> (ap ...)
+ (ip ...) -> (ip ...)
+ (ado ...) -> (ado ...)
+ (ido ...) -> (ido ...)
+ (ret ...) -> (ret ...)
+ (aret ...) -> (aret ...)
.slot -> .slot
.(method ...) -> .(method ...)
atom -> atom
+
+ ;; other compound forms are transformed like this:
+
+ (function ...) -> (op function ...)
+ (operator ...) -> (do operator ...)
+ (macro ...) -> (do macro ...)
.brev
In other words, compound forms whose leftmost symbol is a macro or operator
@@ -56802,7 +56817,9 @@ denoting struct slot access, either explicitly using
.code uref
or
.code qref
-or the respective dot notations, as well as any atom forms.
+or the respective dot notations, forms which invoke any of the
+.code do
+family of operators, as well as any atom forms.
Note: the
.code opip