Skip to content

Document defgen and yield #59

@bremner

Description

@bremner

Currently it seems defgen and yield are undocumented.
I tried to convert the example from plai to use actual generators, but it complains about yield from non-generator.

(defgen (gen)
  (defvar n 0)
  (deffun (loop)
    (yield n)
    (set! n (+ n 1))
    (loop))
  (loop))

(+ (gen) (gen) (gen))

It's not wrong, but I'm not sure the right way to use these primitives (or indeed, if they are going away)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions