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

Function range

src/compute-engine/library/collections.ts:2658–2676  ·  view source on GitHub ↗
(
  expr: Expression
)

Source from the content-addressed store, hash-verified

2656 if (a.nops !== b.nops) return false;
2657 // The elements are not indexed
2658 const has: (x: Expression) => boolean = (x) =>
2659 b.ops.some((y) => x.isSame(y));
2660 return a.ops.every(has);
2661 },
2662 collection: {
2663 ...SET_BASE_HANDLERS,
2664 // A set is not indexable
2665 at: undefined,
2666 indexWhere: undefined,
2667 // A comprehension computes its elements on demand
2668 isLazy: (expr) =>
2669 isFunction(expr) && parseSetComprehension(expr.ops) !== null,
2670 count: (expr) => {
2671 if (!isFunction(expr)) return 0;
2672 const comp = parseSetComprehension(expr.ops);
2673 if (comp === null) return expr.nops;
2674 // Cardinality of the comprehension: number of distinct substituted
2675 // bodies. Symbolic or infinite domains are not enumerable: undefined.
2676 return enumerateSetComprehension(comp)?.length;
2677 },
2678 isEmpty: (expr) => {
2679 if (!isFunction(expr)) return true;

Callers 13

processMinMaxItemFunction · 0.90
collections.tsFile · 0.85
_indexRangeArgFunction · 0.85
mainFunction · 0.85
benchmarkFunction · 0.85
timeitFunction · 0.85
timeitFunction · 0.85
time_budgetFunction · 0.85
mkPFunction · 0.85
mkSmallFunction · 0.85
ops-bench.pyFile · 0.85
onceFunction · 0.85

Calls 2

isFunctionFunction · 0.90
isFiniteFunction · 0.85

Tested by

no test coverage detected