Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #319 Generator function

Write a function g that behaves like an iterator.
Explain if it can be used directly in a for loop.

List<int> g(int start) sync* {
  while (true) {
    yield start;
    start++;
  }
}

Infinite lazy list of ints starting from a specific integer

New implementation...
< >
willard