Evaluate a multi-variable `Solve` and return its solution tuples as arrays * of numbers, in the (lexicographic) order the engine produced them. Throws if * the result is not a decided `List` of `Tuple`s.
(expr: BoxedExpression)
| 25 | /** Evaluate a multi-variable `Solve` and return its solution tuples as arrays |
| 26 | * of numbers, in the (lexicographic) order the engine produced them. Throws if |
| 27 | * the result is not a decided `List` of `Tuple`s. */ |
| 28 | function tuples(expr: BoxedExpression): number[][] { |
| 29 | const r = expr.evaluate(); |
| 30 | if (r.operator !== 'List') |
| 31 | throw new Error(`Expected a List, got ${r.operator}: ${r.toString()}`); |
| 32 | return r.ops!.map((t) => { |
| 33 | if (t.operator !== 'Tuple') |
| 34 | throw new Error(`Expected a Tuple, got ${t.operator}: ${t.toString()}`); |
| 35 | return t.ops!.map((o) => o.re); |
| 36 | }); |
| 37 | } |
| 38 | |
| 39 | describe('SOLVE OVER A DOMAIN — symbolic + membership filter', () => { |
no test coverage detected