From a63eb4c5e64f18993a206aff9fc576ca5cbe699c Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 26 Jan 2021 13:31:14 -0500 Subject: [PATCH] m1v1s0*: Remove cmp args and support c:*/@anyOf This supports all currently-optimized transformations, whereas previously we were permitting only lv:match[@value]. --- src/current/compiler/js.xsl | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/current/compiler/js.xsl b/src/current/compiler/js.xsl index 67427f41..24e51e65 100644 --- a/src/current/compiler/js.xsl +++ b/src/current/compiler/js.xsl @@ -693,17 +693,17 @@ - + + select="compiler:match-on( $symtable-map, $m1 )" /> + select="compiler:match-on( $symtable-map, $v1 )" /> @@ -804,23 +804,23 @@ + + - + - - - + + - - @@ -871,8 +871,7 @@ - - + @@ -880,7 +879,7 @@ - + @@ -902,7 +901,7 @@ - + @@ -1724,9 +1723,9 @@ } // one matrix, one vector, universal quantification - function m1v1u(m, v, mcmp, vcmp) + function m1v1u(m, v) { - const result = m.map((mv, i) => (mv.length ? mv : [0]).map(ms => +(ms === mcmp && v[i] === vcmp))); + const result = m.map((mv, i) => (mv.length ? mv : [0]).map(ms => ms & v[i])); for (let i = result.length; i < v.length; i++) { result[i] = [0]; @@ -1736,12 +1735,12 @@ } // one matrix, one vector, existential quantification - function m1v1e(m, v, mcmp, vcmp) + function m1v1e(m, v) { - const result = m.map((mv, i) => (mv.length ? mv : [0]).map(ms => +(ms === mcmp || v[i] === vcmp))); + const result = m.map((mv, i) => (mv.length ? mv : [0]).map(ms => ms | v[i])); for (let i = result.length; i < v.length; i++) { - result[i] = [v[i] === vcmp]; + result[i] = [v[i]]; } return result; @@ -1811,7 +1810,8 @@ } } - function M(xs, f) { return xs.map(f); } + function M(vs, f) { return vs.map(f); } + function MM(ms, f) { return ms.map(vs => vs.map(f)); } var n = ceq(0); function N(xs) { return xs.map(n); }