(expr: Expression)
| 51 | } |
| 52 | |
| 53 | function serializeFunction(expr: Expression): string | null { |
| 54 | const result = serializeBaseForm(expr); |
| 55 | if (result !== null) return result; |
| 56 | |
| 57 | const h = operator(expr); |
| 58 | if (!h) return null; |
| 59 | |
| 60 | // Special SymPy spellings are not implemented for these heads: |
| 61 | // Add, Multiply, Root, Power, Exp, Subtract, Divide, Negate, |
| 62 | // List, Tuple, Pair, KeyValuePair, |
| 63 | // String, Number, |
| 64 | |
| 65 | const args = operands(expr); |
| 66 | if (args.length === 0) return null; |
| 67 | return `${h}(${args.map((x) => serializeExpression(x) ?? '')})`; |
| 68 | // Lambda serialization is not supported. |
| 69 | } |
| 70 | |
| 71 | function serializeExpression(expr: Expression): string { |
| 72 | return ( |
no test coverage detected