The cl-generator Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-generator Reference Manual

This is the cl-generator Reference Manual, version 1.3.0, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Fri May 24 08:08:21 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

cl-generator

generator in common lisp

supports

provides

cl-generator

cl-generator-util

install

(ql:quickload 'cl-generator)

usage

(require 'cl-generator)
(use-package 'cl-generator)
(use-package 'cl-generator-util)

yield

(defun* test (x)
  (print (yield x)))

(defparameter iter (test 0))
(funcall (iter-next iter))
(funcall (iter-next iter) 1)
(defun* matryoshka (x)
  (yield (yield (yield x))))

the same thing as in javascript

function* matryoshka(x) {
	return yield yield yield x;
}

with-yield

with-yield returns a ITER. lambda*, defun*, defmethod*, defmacro* are implement on the top of with-yield.

(defparameter tmp (with-yield (+ (yield) 1)))
(funcall (iter-next tmp))
(funcall (iter-next tmp) 2)

lambda*

(lambda* ()
  (let ((i 0))
    (loop while (< i 10)
       do (yield i)
         (incf i))))

defun*

(defun* test ()
  (let ((i 0))
    (loop while (< i 10)
       do (yield i)
         (incf i))))

(test)

defmethod*

(defmethod* test ()
  (let ((i 0))
    (loop while (< i 10)
       do (yield i)
         (incf i))))

(test)

defmacro*

(defmacro* test (f)
  `(let ((i 0))
     (loop while (< i 10)
        do (funcall ,f i)
          (incf i))))

(test (lambda (x) (yield x)))

yield*

(defun* a ()
  (yield 1)
  (yield 2)
  (print "end"))

(defun* b ()
  (yield* '(7 8 9))
  (yield* (a)))

(defun* c ()
  (yield* (list (yield 1) (yield 2))))
(defun* a ()
  (yield 1)
  (yield 2)
  (values 3 4 5))

(defun* b ()
  (yield (yield* (a))))

for

(defun* number-generator (x)
  (let ((i 0))
    (loop while (< i x)
       do (yield i)
         (incf i))))

(for (x (number-generator 10)) (print x))

iter-next

(defun* ten-generator ()
  (let ((i 0))
    (loop while (< i 10)
       do (yield i)
         (incf i))))
(defparameter x (ten-generator))
(defparameter res (funcall (iter-next x)))
(loop until (null (iter-next x))
   do (print res)
     (setf res (funcall (iter-next x))))

iter-cur

copy a iter with it's current continuation

(defun* test ()
  (yield 1)
  (yield 2)
  (yield 3))

(defparameter raw (test))
(defparameter copy (funcall (iter-cur raw)))
(print (funcall (iter-next raw)))
(defparameter copy2 (funcall (iter-cur raw)))
(print (funcall (iter-next raw)))
(print (funcall (iter-next copy)))
(print (funcall (iter-next copy2)))

test

(require 'cl-generator-test)
(cl-generator-test:run)

LICENSE

MIT


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 cl-generator

Author

Muromi Ukari

Home Page

https://github.com/ukari/cl-generator

License

MIT

Description

cl-generator, a generator implementation for common lisp

Version

1.3.0

Dependency

cl-cont

Source

cl-generator.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Next: , Previous: , Up: Modules   [Contents][Index]

3.1 cl-generator/base

Parent

cl-generator (system)

Location

base/

Components

Previous: , Up: Modules   [Contents][Index]

3.2 cl-generator/util

Dependency

base (module)

Parent

cl-generator (system)

Location

util/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

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


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 cl-generator.asd

Location

/home/quickref/quicklisp/dists/quicklisp/software/cl-generator-20190307-git/cl-generator.asd

Systems

cl-generator (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 cl-generator/base/package.lisp

Parent

base (module)

Location

base/package.lisp

Packages

cl-generator


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.3 cl-generator/base/cl-generator.lisp

Dependency

package.lisp (file)

Parent

base (module)

Location

base/cl-generator.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.4 cl-generator/util/package.lisp

Parent

util (module)

Location

util/package.lisp

Packages

cl-generator-util


Previous: , Up: Lisp files   [Contents][Index]

4.1.5 cl-generator/util/util.lisp

Dependency

package.lisp (file)

Parent

util (module)

Location

util/util.lisp

Exported Definitions

for (macro)


Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 cl-generator

Source

package.lisp (file)

Nickname

generator

Use List

common-lisp

Exported Definitions
Internal Definitions

Previous: , Up: Packages   [Contents][Index]

5.2 cl-generator-util

Source

package.lisp (file)

Nickname

generator-util

Use List

common-lisp

Exported Definitions

for (macro)


Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Macros

Macro: defmacro* NAME ARGS &body BODY
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: defmethod* NAME ARGS &body BODY
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: defun* NAME ARGS &body BODY
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: for EXPR &body BODY
Package

cl-generator-util

Source

util.lisp (file)

Macro: lambda* ARGS &body BODY
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: with-yield &body BODY
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: yield &optional EXPR
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: yield* EXPR
Package

cl-generator

Source

cl-generator.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Functions

Function: iter-cur INSTANCE
Function: (setf iter-cur) VALUE INSTANCE
Package

cl-generator

Source

cl-generator.lisp (file)

Function: iter-next INSTANCE
Function: (setf iter-next) VALUE INSTANCE
Package

cl-generator

Source

cl-generator.lisp (file)

Function: iter-p OBJECT
Package

cl-generator

Source

cl-generator.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Structures

Structure: iter ()
Package

cl-generator

Source

cl-generator.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods
Direct slots
Slot: cur
Type

function

Readers

iter-cur (function)

Writers

(setf iter-cur) (function)

Slot: next
Type

(or null function)

Readers

iter-next (function)

Writers

(setf iter-next) (function)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Macros

Macro: enable-yield &body BODY
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: gen-pass EXPR CONT
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: isolate-cont &body BODY
Package

cl-generator

Source

cl-generator.lisp (file)

Macro: local-macros &body BODY
Package

cl-generator

Source

cl-generator.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Functions

Function: copy-iter INSTANCE
Package

cl-generator

Source

cl-generator.lisp (file)

Function: copy-pass INSTANCE
Package

cl-generator

Source

cl-generator.lisp (file)

Function: make-iter &key (CUR CUR) (NEXT NEXT)
Package

cl-generator

Source

cl-generator.lisp (file)

Function: make-pass &key (CONT CONT) (RESULTS RESULTS)
Package

cl-generator

Source

cl-generator.lisp (file)

Function: pass-cont INSTANCE
Function: (setf pass-cont) VALUE INSTANCE
Package

cl-generator

Source

cl-generator.lisp (file)

Function: pass-p OBJECT
Package

cl-generator

Source

cl-generator.lisp (file)

Function: pass-results INSTANCE
Function: (setf pass-results) VALUE INSTANCE
Package

cl-generator

Source

cl-generator.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.3 Generic functions

Generic Function: gen-next ITER CONT
Package

cl-generator

Methods
Method: gen-next (ITER iter) (END null)
Source

cl-generator.lisp (file)

Method: gen-next (ITER iter) (PASS pass)
Source

cl-generator.lisp (file)

Method: gen-next (ITER iter) (CONT function)
Source

cl-generator.lisp (file)

Generic Function: iter-id END
Package

cl-generator

Methods
Method: iter-id (CONT function)
Source

cl-generator.lisp (file)

Method: iter-id (END null)
Source

cl-generator.lisp (file)

Generic Function: iter-next-proxy ITER NEXT CONT
Package

cl-generator

Methods
Method: iter-next-proxy (ITER iter) (NEXT function) (CONT function)
Source

cl-generator.lisp (file)

Generic Function: pass-next PASS
Package

cl-generator

Methods
Method: pass-next (PASS pass)
Source

cl-generator.lisp (file)

Method: pass-next (PASS null)
Source

cl-generator.lisp (file)

Generic Function: proxy INNER CONT
Package

cl-generator

Methods
Method: proxy (INNER iter) (CONT function)
Source

cl-generator.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.4 Structures

Structure: pass ()
Package

cl-generator

Source

cl-generator.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods
Direct slots
Slot: cont
Type

(or null function)

Readers

pass-cont (function)

Writers

(setf pass-cont) (function)

Slot: results
Type

list

Readers

pass-results (function)

Writers

(setf pass-results) (function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L   M  
Index Entry  Section

C
cl-generator.asd: The cl-generator<dot>asd file
cl-generator/base: The cl-generator/base module
cl-generator/base/cl-generator.lisp: The cl-generator/base/cl-generator<dot>lisp file
cl-generator/base/package.lisp: The cl-generator/base/package<dot>lisp file
cl-generator/util: The cl-generator/util module
cl-generator/util/package.lisp: The cl-generator/util/package<dot>lisp file
cl-generator/util/util.lisp: The cl-generator/util/util<dot>lisp file

F
File, Lisp, cl-generator.asd: The cl-generator<dot>asd file
File, Lisp, cl-generator/base/cl-generator.lisp: The cl-generator/base/cl-generator<dot>lisp file
File, Lisp, cl-generator/base/package.lisp: The cl-generator/base/package<dot>lisp file
File, Lisp, cl-generator/util/package.lisp: The cl-generator/util/package<dot>lisp file
File, Lisp, cl-generator/util/util.lisp: The cl-generator/util/util<dot>lisp file

L
Lisp File, cl-generator.asd: The cl-generator<dot>asd file
Lisp File, cl-generator/base/cl-generator.lisp: The cl-generator/base/cl-generator<dot>lisp file
Lisp File, cl-generator/base/package.lisp: The cl-generator/base/package<dot>lisp file
Lisp File, cl-generator/util/package.lisp: The cl-generator/util/package<dot>lisp file
Lisp File, cl-generator/util/util.lisp: The cl-generator/util/util<dot>lisp file

M
Module, cl-generator/base: The cl-generator/base module
Module, cl-generator/util: The cl-generator/util module

Jump to:   C   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
C   D   E   F   G   I   L   M   P   W   Y  
Index Entry  Section

(
(setf iter-cur): Exported functions
(setf iter-next): Exported functions
(setf pass-cont): Internal functions
(setf pass-results): Internal functions

C
copy-iter: Internal functions
copy-pass: Internal functions

D
defmacro*: Exported macros
defmethod*: Exported macros
defun*: Exported macros

E
enable-yield: Internal macros

F
for: Exported macros
Function, (setf iter-cur): Exported functions
Function, (setf iter-next): Exported functions
Function, (setf pass-cont): Internal functions
Function, (setf pass-results): Internal functions
Function, copy-iter: Internal functions
Function, copy-pass: Internal functions
Function, iter-cur: Exported functions
Function, iter-next: Exported functions
Function, iter-p: Exported functions
Function, make-iter: Internal functions
Function, make-pass: Internal functions
Function, pass-cont: Internal functions
Function, pass-p: Internal functions
Function, pass-results: Internal functions

G
gen-next: Internal generic functions
gen-next: Internal generic functions
gen-next: Internal generic functions
gen-next: Internal generic functions
gen-pass: Internal macros
Generic Function, gen-next: Internal generic functions
Generic Function, iter-id: Internal generic functions
Generic Function, iter-next-proxy: Internal generic functions
Generic Function, pass-next: Internal generic functions
Generic Function, proxy: Internal generic functions

I
isolate-cont: Internal macros
iter-cur: Exported functions
iter-id: Internal generic functions
iter-id: Internal generic functions
iter-id: Internal generic functions
iter-next: Exported functions
iter-next-proxy: Internal generic functions
iter-next-proxy: Internal generic functions
iter-p: Exported functions

L
lambda*: Exported macros
local-macros: Internal macros

M
Macro, defmacro*: Exported macros
Macro, defmethod*: Exported macros
Macro, defun*: Exported macros
Macro, enable-yield: Internal macros
Macro, for: Exported macros
Macro, gen-pass: Internal macros
Macro, isolate-cont: Internal macros
Macro, lambda*: Exported macros
Macro, local-macros: Internal macros
Macro, with-yield: Exported macros
Macro, yield: Exported macros
Macro, yield*: Exported macros
make-iter: Internal functions
make-pass: Internal functions
Method, gen-next: Internal generic functions
Method, gen-next: Internal generic functions
Method, gen-next: Internal generic functions
Method, iter-id: Internal generic functions
Method, iter-id: Internal generic functions
Method, iter-next-proxy: Internal generic functions
Method, pass-next: Internal generic functions
Method, pass-next: Internal generic functions
Method, proxy: Internal generic functions

P
pass-cont: Internal functions
pass-next: Internal generic functions
pass-next: Internal generic functions
pass-next: Internal generic functions
pass-p: Internal functions
pass-results: Internal functions
proxy: Internal generic functions
proxy: Internal generic functions

W
with-yield: Exported macros

Y
yield: Exported macros
yield*: Exported macros

Jump to:   (  
C   D   E   F   G   I   L   M   P   W   Y  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   C   N   R   S  
Index Entry  Section

C
cont: Internal structures
cur: Exported structures

N
next: Exported structures

R
results: Internal structures

S
Slot, cont: Internal structures
Slot, cur: Exported structures
Slot, next: Exported structures
Slot, results: Internal structures

Jump to:   C   N   R   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   I   P   S  
Index Entry  Section

C
cl-generator: The cl-generator system
cl-generator: The cl-generator package
cl-generator-util: The cl-generator-util package

I
iter: Exported structures

P
Package, cl-generator: The cl-generator package
Package, cl-generator-util: The cl-generator-util package
pass: Internal structures

S
Structure, iter: Exported structures
Structure, pass: Internal structures
System, cl-generator: The cl-generator system

Jump to:   C   I   P   S