scan(L, f)
scan(L, L', f)
scan(n, f)
scan(L, f) applies the function f to each element of the list L. The function values are discarded.
|
|
scan(n, f) applies the function f to each element of the list 0, 1, ..., n-1
|
|
The keyword break can be used to terminate the scan prematurely, and optionally to specify a return value for the expression. Here we use it to locate the first even number in a list.
|
If L is an instance of a class with the iterator method installed (e.g., a string), then f is applied to the values obtained by repeatedly calling next on the output of iterator L until StopIteration is returned.
|
The object scan is a compiled function.