MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / collectionContains

Function collectionContains

src/compute-engine/collection-utils.ts:170–184  ·  view source on GitHub ↗
(
  expr: Expression,
  target: Expression
)

Source from the content-addressed store, hash-verified

168 * For a lazy view, `isEmptyCollection` can compute the first element: the
169 * `isEmpty` handler of `Filter` applies the predicate until one element
170 * passes. This predicate is called while an expression is canonicalized
171 * (`isFiniteIndexedCollection`, from the argument checks of a numeric
172 * operator), where a predicate over a symbol without a value cannot answer
173 * and throws. With `C := [1, 2, 3]`, the definition
174 * `s(n) := Filter(C, Z ↦ n < |Z|) + s(n - 1)` then did not canonicalize.
175 * A collection that cannot be enumerated (`Linspace(a, 1, 3)`) has no
176 * elements to compute, so its `isEmptyCollection` is read from its count.
177 *
178 * This predicate is different from {@link isEnumerableSource}. This
179 * predicate is cheap: it reads the `isFiniteCollection`,
180 * `isEnumerableCollection` and, for a collection that cannot be enumerated,
181 * `isEmptyCollection` flags, and never evaluates. It accepts an
182 * `isEnumerableCollection` of `undefined`. `isEnumerableSource` evaluates
183 * the source to decide that `undefined` case, so it can tell
184 * `Characters("abc")` from `Characters(s)` with a valueless `s`. Use this
185 * predicate in an evaluate handler, where the operands are already evaluated
186 * and a walk of the source evaluates it again. Use `isEnumerableSource` in a
187 * lazy collection handler, where the source can still be unevaluated and an

Callers

nothing calls this directly

Calls 3

indexWhereMethod · 0.65
isSameMethod · 0.65
eachMethod · 0.65

Tested by

no test coverage detected