| 117 | * `MAX_SIZE_EAGER_COLLECTION`, the result is a Union expression |
| 118 | * |
| 119 | */ |
| 120 | export const MAX_SIZE_EAGER_COLLECTION = 100; |
| 121 | |
| 122 | /** |
| 123 | * True when `col` is a finite indexed collection whose elements can be |
| 124 | * walked. A finite collection whose elements cannot be computed (see |
| 125 | * {@link isWalkableFiniteCollection}) is excluded, because most callers of |
| 126 | * this predicate read the elements with `at()` or `each()`, and they would |
| 127 | * read such a collection as empty. |
| 128 | * |
| 129 | * Some callers do not walk `col` when this predicate is `false`: they keep |
| 130 | * `col` as one element instead (`flattenToDepth()` keeps a scalar as a |
| 131 | * leaf). Such a caller must not keep a finite collection with no computable |
| 132 | * elements as a leaf, because it would give a list with the wrong elements |
| 133 | * and the wrong count. It must test for that case itself and decline. |
| 134 | */ |
| 135 | export function isFiniteIndexedCollection(col: Expression): boolean { |
| 136 | return isWalkableFiniteCollection(col) && col.isIndexedCollection; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * True when `col` is a finite collection whose elements can be walked. |
| 141 | * |
| 142 | * A finite collection can know its size and still have no computable |
| 143 | * elements. `Linspace(a, 1, 3)` with a symbolic `a` has `count` 3 and |