# The trivial-continuation Reference Manual

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

# The trivial-continuation Reference Manual

This is the trivial-continuation Reference Manual, version 0.1.2, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Fri May 24 09:57:41 2019 GMT+0.

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

# Trivial Continuation Manual

## Description

This library provides an implementation of function call continuation and combination.

## Installing trivial-continuation

This project is available in the latest QuickLisp distribution, so installing it is reduced to calling:

``````(ql:quickload :trivial-continuation)
``````

## Working Example

``````(cc/define simple-continuation (seq)
(if seq
cc/create-return (car seq)
#'(lambda () (simple-continuation (cdr seq)))
:operation :combine)
(cc/delegate)))

(let ((cont (combine-continuations (simple-continuation '(1 2 3 4))
(simple-continuation '(5 6 7 8)))))
(format t \"~a\" (result cont))

(setf cont (call-continuation cont))
(format t \"~a\" (result cont)))

``````

## Exported Symbols

• [class] CONTINUATION-RESULT

The CONTINUATION-RESULT class represents the result of a method, the continuation from it and the combination operation.

• [reader] RESULT CONTINUATION-RESULT (:RESULT = NIL)

The RESULT slot carries the return value from calling a continuation.

• [reader] CONTINUATION CONTINUATION-RESULT (:CONTINUATION = NIL)

The CONTINUATION slot holds the continuation function to be called next.

• [reader] OPERATION CONTINUATION-RESULT (:OPERATION = :TERMINATE)

The OPERATION slot controls how two continuations are to be combined.
Valid values are:
:combine - the current continuation carries a valid result, and still other continuations should be called
:delegate - the current continuation does not have any result, but still another continuation should be called
:terminate - no further continuation shall be called

• [macro] CC/DEFINE (&REST ARGS) &BODY BODY

Define a function to serve as a continuation.

• [macro] CC/RETURN RESULT

Return the RESULT from inside of CC/DEFINE.

• [macro] CC/CREATE-RETURN VALUE CONTINUATION &KEY (OPERATION :COMBINE)

Create a new result to be returned from inside CC/DEFINE.

• [macro] CC/DELEGATE

Indicate that this does not carry any result, but instead a continuation should be called. Used inside of CC/DEFINE.

• [macro] CC/TERMINATE

Indicate that this result should be the last in a chain. Used inside of CC/DEFINE.

• [function] CC/CONTINUE CONT

Call the continuation of a CONTINUATION-RESULT, checking if one is defined and modifying CONT. Emits a warning when calling on an object with OPERATION :terminate.

Combine two continuations to form a new one. HEAD and TAIL can (independently) be CONTINUATION-RESULT or a function returning a CONTINUATION-RESULT

• [function] CALL-CONTINUATION CONT

Call the continuation of a CONTINUATION-RESULT, checking if one is defined. Emits a warning when calling on an object with OPERATION :terminate.

• [function] FOLLOW-CHAIN RESULT

Return whether RESULT has a valid continuation.

This library is released under the MIT License. Please refer to the LICENSE to get the full licensing text.

## Contributing to this project

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 trivial-continuation

Author

Eric Diethelm <ediethelm@yahoo.com>

MIT

Description

Provides an implementation of function call continuation and combination.

Version

0.1.2

Dependencies
• trivial-utilities
• log4cl
• mgl-pax
Source

trivial-continuation.asd (file)

Components

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

## 3 Files

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

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

### 3.1 Lisp

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

#### 3.1.1 trivial-continuation.asd

Location

trivial-continuation.asd

Systems

trivial-continuation (system)

#### 3.1.2 trivial-continuation/package.lisp

Parent

trivial-continuation (system)

Location

package.lisp

Packages

#### 3.1.3 trivial-continuation/trivial-continuation.lisp

Parent

trivial-continuation (system)

Location

trivial-continuation.lisp

Exported Definitions
Internal Definitions

#### 3.1.4 trivial-continuation/documentation.lisp

Parent

trivial-continuation (system)

Location

documentation.lisp

Exported Definitions

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

## 4 Packages

Packages are listed by definition order.

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

### 4.1 trivial-continuation

trivial-continuation provides an implementation of function call continuation and combination.

Source

package.lisp (file)

Use List
• mgl-pax
• common-lisp
Exported Definitions
Internal Definitions

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

## 5 Definitions

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

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

### 5.1 Exported definitions

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

#### 5.1.1 Special variables

Special Variable: @trivial-continuation-contributing
Package
Source

documentation.lisp (file)

Special Variable: @trivial-continuation-description
Package
Source

documentation.lisp (file)

Special Variable: @trivial-continuation-example
Package
Source

documentation.lisp (file)

Special Variable: @trivial-continuation-exported
Package
Source

documentation.lisp (file)

Special Variable: @trivial-continuation-installing
Package
Source

documentation.lisp (file)

Package
Source

documentation.lisp (file)

Special Variable: @trivial-continuation-manual
Package
Source

documentation.lisp (file)

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

#### 5.1.2 Macros

Macro: cc/create-return VALUE CONTINUATION &key OPERATION NAMED-DEFINE

Create a new result to be returned from inside *CC/DEFINE*.

Package
Source
Macro: cc/define NAME (&rest ARGS) &body BODY

Define a function to serve as a continuation.

Package
Source
Macro: cc/delegate &key NAMED-DEFINE

Indicate that this does not carry any result, but instead a continuation should be called. Used inside of *CC/DEFINE*.

Package
Source
Macro: cc/return RESULT

Return the *RESULT* from inside of *CC/DEFINE*.

Package
Source
Macro: cc/terminate &key NAMED-DEFINE

Indicate that this result should be the last in a chain. Used inside of *CC/DEFINE*.

Package
Source

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

#### 5.1.3 Functions

Function: call-continuation CONT

Call the continuation of a *CONTINUATION-RESULT*, checking if one is defined. Emits a warning when calling on an object with *OPERATION* :terminate.

Package
Source
Function: cc/continue CONT

Call the continuation of a *CONTINUATION-RESULT*, checking if one is defined and modifying *CONT*. Emits a warning when calling on an object with *OPERATION* :terminate.

Package
Source
Function: follow-chain RESULT

Return whether *RESULT* has a valid continuation.

Package
Source

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

#### 5.1.4 Generic functions

Combine two continuations to form a new one. *HEAD* and *TAIL* can (independently) be *CONTINUATION-RESULT* or a function returning a *CONTINUATION-RESULT*

Package
Source
Methods
Method: combine-continuations (HEAD function) (TAIL function)
Method: combine-continuations (HEAD function) (TAIL continuation-result)
Method: combine-continuations (HEAD continuation-result) (TAIL function)
Method: combine-continuations (HEAD continuation-result) (TAIL continuation-result)
Generic Function: continuation OBJECT
Package
Methods
Method: continuation (CONTINUATION-RESULT continuation-result)

The *CONTINUATION* slot holds the continuation function to be called next.

Source
Generic Function: operation OBJECT
Package
Methods
Method: operation (CONTINUATION-RESULT continuation-result)

The *OPERATION* slot controls how two continuations are to be combined.
Valid values are:
:combine - the current continuation carries a valid result, and still other continuations should be called :delegate - the current continuation does not have any result, but still another continuation should be called :terminate - no further continuation shall be called

Source
Generic Function: result OBJECT
Package
Methods
Method: result (CONTINUATION-RESULT continuation-result)

The *RESULT* slot carries the return value from calling a continuation.

Source

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

#### 5.1.5 Classes

Class: continuation-result ()

The *CONTINUATION-RESULT* class represents the result of a method, the continuation from it and the combination operation.

Package
Source
Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: result

The *RESULT* slot carries the return value from calling a continuation.

Initargs

:result

result (generic function)

Slot: continuation

The *CONTINUATION* slot holds the continuation function to be called next.

Type

(or null function)

Initargs

:continuation

continuation (generic function)

Slot: operation

The *OPERATION* slot controls how two continuations are to be combined.
Valid values are:
:combine - the current continuation carries a valid result, and still other continuations should be called :delegate - the current continuation does not have any result, but still another continuation should be called :terminate - no further continuation shall be called

Type

(member :terminate :combine :delegate)

Initargs

:operation

Initform

:terminate

operation (generic function)

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

### 5.2 Internal definitions

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

#### 5.2.1 Special variables

Special Variable: +continuation-failed+
Package
Source
Special Variable: +continue-to-next+
Package
Source

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

#### 5.2.2 Macros

Macro: cc/define-lambda (&rest ARGS) &body BODY

Define a lambda to serve as a continuation.

Package
Source
Macro: cc/define-named-lambda NAME (&rest ARGS) &body BODY

Define a named lambda to serve as a continuation.

Package
Source

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

#### 5.2.3 Functions

Function: combine FIRST-CONT NEXT-CONT
Package
Source
Function: rewrite-terminators NAME BODY

Run over *BODY* adding (:named-define name) to every cc/{delegate|terminate|create-return}.

Package
Source

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

## Appendix A Indexes

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

### A.1 Concepts

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

### A.2 Functions

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