map (Function)
Signature: map(iterator: Iterator<t0>, fn: (t0) -> t1) -> Iterator<t1>
Description: Transforms each element in an iterator using a function, returning a new iterator.
Parameters
- iterator (
Iterator<t0>): The iterator to transform - fn (
(t0) -> t1): The transformation function
Returns: Iterator<t1>
Example
let doubled = map(range(1, 4), fn(x) => satMul(x, 2))
forEach(doubled, print) // Prints: 2, 4, 6
doubled = map (range (1, 4), \x => satMul (x, 2))
forEach (doubled, print) // Prints: 2, 4, 6