The generators Reference Manual

This is the generators Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 05:24:41 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 generators

A common lisp package providing python style generators based on delimited continuations

Author

<>

License

BSD

Version

0.1

Dependencies
  • cl-cont (system).
  • alexandria (system).
  • iterate (system).
Source

generators.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 generators/generators.asd

Source

generators.asd.

Parent Component

generators (system).

ASDF Systems

generators.

Packages

generators.system.


3.1.2 generators/packages.lisp

Source

generators.asd.

Parent Component

generators (system).

Packages

generators.


3.1.3 generators/generators.lisp

Source

generators.asd.

Parent Component

generators (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 generators

Source

packages.lisp.

Use List
  • common-lisp.
  • iterate.
Public Interface
Internals

4.2 generators.system

Source

generators.asd.

Use List
  • asdf/interface.
  • common-lisp.

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: make-generator ((&key final-value final-exception name) &body body)

returns a function that when called yields the next values. Inside of body, you can yield any number of values that you wish by calling (yield &rest args) which is scoped to the body

Package

generators.

Source

generators.lisp.


5.1.2 Ordinary functions

Function: generate-lisp-tree-nodes (trees &optional leaves-only?)

Do a depth first traversal of some set of trees yielding every node

Package

generators.

Source

generators.lisp.


5.1.3 Generic functions

Generic Function: force (generator)

Forces the generator to produce a list of its output

Package

generators.

Source

generators.lisp.

Methods
Method: force ((g generator))
Generic Reader: generator (condition)
Generic Writer: (setf generator) (condition)
Package

generators.

Methods
Reader Method: generator ((condition stop-iteration))
Writer Method: (setf generator) ((condition stop-iteration))
Source

generators.lisp.

Target Slot

generator.

Generic Function: next (generator &rest args)

Returns the next value of this generator

Package

generators.

Source

generators.lisp.

Methods
Method: next ((gen generator) &rest args)
Generic Function: reset (generator)

Restarts the generator from its original continuation

Package

generators.

Source

generators.lisp.

Methods
Method: reset ((gen generator))

5.1.4 Conditions

Condition: stop-iteration
Package

generators.

Source

generators.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: generator
Initform

(quote nil)

Initargs

:generator

Readers

generator.

Writers

(setf generator).

Slot: handled?
Initform

(quote nil)

Initargs

:handled?

Readers

handled?.

Writers

(setf handled?).


5.1.5 Classes

Class: generator

A class that stores all the needed structure for a generator

Package

generators.

Source

generators.lisp.

Direct methods
Direct slots
Slot: continuation

The current continuation of the generator

Initargs

:continuation

Readers

continuation.

Writers

(setf continuation).

Slot: use-final-value?

Should this generator, generate a sigil value when complete
if nil will raise the final-exception (defaults ’stop-iteration)

Initargs

:use-final-value?

Readers

use-final-value?.

Writers

(setf use-final-value?).

Slot: final-value

The value to generate if we are using a final-value instead of raising exceptions

Initargs

:final-value

Readers

final-value.

Writers

(setf final-value).

Slot: final-exception

An exception to raise when we are done iterating (if not using final-value)

Initform

(quote generators:stop-iteration)

Initargs

:final-exception

Readers

final-exception.

Writers

(setf final-exception).

Slot: finished?

Has this generator generated all values?

Initargs

:finished?

Readers

finished?.

Writers

(setf finished?).

Slot: original-continuation

The starting point of this generator

Initargs

:original-continuation

Readers

original-continuation.

Writers

(setf original-continuation).

Slot: name
Initargs

:name

Readers

name.

Writers

(setf name).


5.2 Internals


5.2.1 Macros

Macro: clause-for-a-leaf-of-lisp-tree-3 (&key for a-leaf-of-lisp-tree generate)
Package

generators.

Source

generators.lisp.

Macro: clause-for-a-node-of-lisp-tree-2 (&key for a-node-of-lisp-tree generate)
Package

generators.

Source

generators.lisp.

Macro: clause-for-in-generator-1 (&key for in-generator generate)
Package

generators.

Source

generators.lisp.


5.2.2 Ordinary functions

Function: %mv-gen (g)

Generates a value from the generator, if the generator throws stop iteration returns (values nil T),
turns off call/cc so that this works

Package

generators.

Source

generators.lisp.

Function: %stop-iteration (generator)
Package

generators.

Source

generators.lisp.

Function: only-one? (list)
Package

generators.

Source

generators.lisp.


5.2.3 Generic functions

Generic Reader: continuation (object)
Generic Writer: (setf continuation) (object)
Package

generators.

Methods
Reader Method: continuation ((generator generator))
Writer Method: (setf continuation) ((generator generator))

The current continuation of the generator

Source

generators.lisp.

Target Slot

continuation.

Generic Reader: final-exception (object)
Generic Writer: (setf final-exception) (object)
Package

generators.

Methods
Reader Method: final-exception ((generator generator))
Writer Method: (setf final-exception) ((generator generator))

An exception to raise when we are done iterating (if not using final-value)

Source

generators.lisp.

Target Slot

final-exception.

Generic Reader: final-value (object)
Generic Writer: (setf final-value) (object)
Package

generators.

Methods
Reader Method: final-value ((generator generator))
Writer Method: (setf final-value) ((generator generator))

The value to generate if we are using a final-value instead of raising exceptions

Source

generators.lisp.

Target Slot

final-value.

Generic Reader: finished? (object)
Generic Writer: (setf finished?) (object)
Package

generators.

Methods
Reader Method: finished? ((generator generator))
Writer Method: (setf finished?) ((generator generator))

Has this generator generated all values?

Source

generators.lisp.

Target Slot

finished?.

Generic Reader: handled? (condition)
Generic Writer: (setf handled?) (condition)
Package

generators.

Methods
Reader Method: handled? ((condition stop-iteration))
Writer Method: (setf handled?) ((condition stop-iteration))
Source

generators.lisp.

Target Slot

handled?.

Generic Reader: name (object)
Package

generators.

Methods
Reader Method: name ((generator generator))

automatically generated reader method

Source

generators.lisp.

Target Slot

name.

Generic Writer: (setf name) (object)
Package

generators.

Methods
Writer Method: (setf name) ((generator generator))

automatically generated writer method

Source

generators.lisp.

Target Slot

name.

Generic Reader: original-continuation (object)
Generic Writer: (setf original-continuation) (object)
Package

generators.

Methods
Reader Method: original-continuation ((generator generator))
Writer Method: (setf original-continuation) ((generator generator))

The starting point of this generator

Source

generators.lisp.

Target Slot

original-continuation.

Generic Reader: use-final-value? (object)
Generic Writer: (setf use-final-value?) (object)
Package

generators.

Methods
Reader Method: use-final-value? ((generator generator))
Writer Method: (setf use-final-value?) ((generator generator))

Should this generator, generate a sigil value when complete
if nil will raise the final-exception (defaults ’stop-iteration)

Source

generators.lisp.

Target Slot

use-final-value?.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
C   F   G   H   M   N   O   R   U  
Index Entry  Section

%
%mv-gen: Private ordinary functions
%stop-iteration: Private ordinary functions

(
(setf continuation): Private generic functions
(setf continuation): Private generic functions
(setf final-exception): Private generic functions
(setf final-exception): Private generic functions
(setf final-value): Private generic functions
(setf final-value): Private generic functions
(setf finished?): Private generic functions
(setf finished?): Private generic functions
(setf generator): Public generic functions
(setf generator): Public generic functions
(setf handled?): Private generic functions
(setf handled?): Private generic functions
(setf name): Private generic functions
(setf name): Private generic functions
(setf original-continuation): Private generic functions
(setf original-continuation): Private generic functions
(setf use-final-value?): Private generic functions
(setf use-final-value?): Private generic functions

C
clause-for-a-leaf-of-lisp-tree-3: Private macros
clause-for-a-node-of-lisp-tree-2: Private macros
clause-for-in-generator-1: Private macros
continuation: Private generic functions
continuation: Private generic functions

F
final-exception: Private generic functions
final-exception: Private generic functions
final-value: Private generic functions
final-value: Private generic functions
finished?: Private generic functions
finished?: Private generic functions
force: Public generic functions
force: Public generic functions
Function, %mv-gen: Private ordinary functions
Function, %stop-iteration: Private ordinary functions
Function, generate-lisp-tree-nodes: Public ordinary functions
Function, only-one?: Private ordinary functions

G
generate-lisp-tree-nodes: Public ordinary functions
generator: Public generic functions
generator: Public generic functions
Generic Function, (setf continuation): Private generic functions
Generic Function, (setf final-exception): Private generic functions
Generic Function, (setf final-value): Private generic functions
Generic Function, (setf finished?): Private generic functions
Generic Function, (setf generator): Public generic functions
Generic Function, (setf handled?): Private generic functions
Generic Function, (setf name): Private generic functions
Generic Function, (setf original-continuation): Private generic functions
Generic Function, (setf use-final-value?): Private generic functions
Generic Function, continuation: Private generic functions
Generic Function, final-exception: Private generic functions
Generic Function, final-value: Private generic functions
Generic Function, finished?: Private generic functions
Generic Function, force: Public generic functions
Generic Function, generator: Public generic functions
Generic Function, handled?: Private generic functions
Generic Function, name: Private generic functions
Generic Function, next: Public generic functions
Generic Function, original-continuation: Private generic functions
Generic Function, reset: Public generic functions
Generic Function, use-final-value?: Private generic functions

H
handled?: Private generic functions
handled?: Private generic functions

M
Macro, clause-for-a-leaf-of-lisp-tree-3: Private macros
Macro, clause-for-a-node-of-lisp-tree-2: Private macros
Macro, clause-for-in-generator-1: Private macros
Macro, make-generator: Public macros
make-generator: Public macros
Method, (setf continuation): Private generic functions
Method, (setf final-exception): Private generic functions
Method, (setf final-value): Private generic functions
Method, (setf finished?): Private generic functions
Method, (setf generator): Public generic functions
Method, (setf handled?): Private generic functions
Method, (setf name): Private generic functions
Method, (setf original-continuation): Private generic functions
Method, (setf use-final-value?): Private generic functions
Method, continuation: Private generic functions
Method, final-exception: Private generic functions
Method, final-value: Private generic functions
Method, finished?: Private generic functions
Method, force: Public generic functions
Method, generator: Public generic functions
Method, handled?: Private generic functions
Method, name: Private generic functions
Method, next: Public generic functions
Method, original-continuation: Private generic functions
Method, reset: Public generic functions
Method, use-final-value?: Private generic functions

N
name: Private generic functions
name: Private generic functions
next: Public generic functions
next: Public generic functions

O
only-one?: Private ordinary functions
original-continuation: Private generic functions
original-continuation: Private generic functions

R
reset: Public generic functions
reset: Public generic functions

U
use-final-value?: Private generic functions
use-final-value?: Private generic functions