Janet Notes and Examples

Laziness, Generators, and Streams

Some terminology:

  • A lazy sequence is one that only computes elements as you ask for them. After you’ve realized an element, it’s there as part of that sequence — it doesn’t go away. As you realize more elements of the sequence, the lazy sequence gets larger.

  • Generators and streams are stateful things — they emit values until they’re exhausted. See spork/generators.