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

Function takeIterator

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

Source from the content-addressed store, hash-verified

3189 complexity: 8200,
3190 signature: '(dictionary<any>) -> list',
3191 type: ([dict]) => {
3192 const t = dict.type.type;
3193 if (typeof t === 'object' && t.kind === 'dictionary')
3194 return { kind: 'list', elements: t.values };
3195 if (typeof t === 'object' && t.kind === 'record')
3196 return { kind: 'list', elements: widen(...Object.values(t.elements)) };
3197 return parseType('list<any>');
3198 },
3199 // Complete precondition — see `Keys`.
3200 canEnumerate: (expr) =>
3201 isFunction(expr)
3202 ? canEnumerateOperand(expr.op1, isDictionary)
3203 : undefined,
3204 evaluate: ([dict], { engine: ce }) => {
3205 if (!isDictionary(dict)) return undefined;
3206 // Same insertion order as `Keys` and `each()`.
3207 return ce.function('List', dict.values);
3208 },
3209 },
3210
3211 Single: {
3212 description: 'A tuple with a single element',
3213 // A pure container: it STORES its operands, and no position ever invokes
3214 // a function-valued one (`List(randomF)` is pure to build). See the
3215 // `invokes` metadata in `docs/EFFECTS-MODEL.md`.

Callers

nothing calls this directly

Calls 4

isFunctionFunction · 0.90
toIntegerFunction · 0.90
absMethod · 0.65
atMethod · 0.65

Tested by

no test coverage detected