Iterate
Generated from the engine's own definition: compute-engine's symbol, which we neither extend nor document by hand. No examples yet — the crosswalk is the reason it has a page.
Produce an infinite sequence by repeatedly applying a function to the previous value, starting with an initial value. The function is invoked as f(index, acc): index is the 1-based position of the element being produced, and acc is the previous element — the initial value when producing element 1. Element k is therefore f(k, element(k-1)). A function whose type says it is UNARY is applied to the accumulator alone (Iterate(2 * _, 1) produces [2, 4, 8, 16, …]); a statically-unknown arity keeps the two-argument form.
Iterate(function, initial: any?) -> listas compute-engine declares itTyped signatures
| Type | Package | Applies |
|---|---|---|
(function, initial: any?) -> list | compute-engine | always |