Name

generator

Usage

macro

Syntax

(generator &body forms)

Description

Returns an IEnumerable that returns a value for each yield statement in forms. The yield statements may be issued by functions called by forms. Generators are implemented as native threads.

user 1 > (generator (yield 1) (yield 2) (yield 3))
it: #<Kiezel.GeneratorThreadContext>
user 2 > (as-vector it)
it: #v(1 2 3)
user 3 > (macroexpand '(generator (yield 1) (yield 2) (yield 3)))
it: (system:create-generator (lambda null (yield 1) (yield 2) (yield 3)))