Generators in Lone Lisp

(matheusmoreira.com)

35 points | by matheusmoreira 3 days ago

1 comments

  • hencq 2 hours ago
    I like the overview given in this Stackoverflow answer [1] (based on an even earlier comment) which classifies different types of continuations:

    - Asymmetric or symmetric

    - Stackful or stackless

    - Delimited or undelimited

    - Multi-prompt or single prompt

    - Reentrant or non-reentrant

    - Clonable or not

    Based on that these generators (or semi-coroutines as the article also calls them) seem to be asymmetric, stackful, delimited, single prompt(?), non-reentrant continuations.

    [1] - https://stackoverflow.com/questions/62817878/what-are-the-sp...

    • matheusmoreira 4 minutes ago
      That's a great overview. Yeah they are asymmetric, Wikipedia says symmetric and asymmetric correspond to coroutines and semicoroutines. They are also stackful and delimited. They are single shot by design, though I could easily make it possible to restart the generator from scratch if needed. As for single prompt vs multiprompt... I'm not too sure about this one. I have a check to prevent recursion but nesting generators shouldn't be a problem since they keep track of their own callers.