| 824 | * - only the terms that the recurrence reads are computed: a term in a |
| 825 | * branch of an `If` that is not taken is not computed; |
| 826 | * - the depth of the JavaScript calls does not grow with the index (a |
| 827 | * recursive evaluation of `F_{500}` exceeded the call stack); |
| 828 | * - the computation of each term is completed one time in the read, also |
| 829 | * when it changes a symbol that the recurrence reads and the memos are |
| 830 | * cleared. |
| 831 | * |
| 832 | * A computation is done again only for a pure sequence: the second |
| 833 | * computation then does nothing that can be seen, and it draws no random |
| 834 | * number. A term that the recurrence always reads (`lowerTermOffsets()`) |
| 835 | * is put on the stack before the term that reads it is computed, so the |
| 836 | * computation of most terms is not stopped. |
| 837 | * |
| 838 | * The read is declined when it needs more than `MAX_TERMS_PER_READ` terms, |
| 839 | * and it stops with the deadline of the evaluation |
| 840 | * (`docs/TIMEOUT-MODEL.md`). |
| 841 | */ |
| 842 | const computeTerm = ( |
| 843 | root: number[], |
| 844 | read: SequenceRead, |
| 845 | engine: ComputeEngine, |
| 846 | numericApproximation: boolean | undefined |
| 847 | ): Expression | undefined => { |