The constantfold Reference Manual

This is the constantfold Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sat Dec 03 21:09:04 2022 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 constantfold

User-defined constant folding facility

Author

Masataro Asai

Contact

License

LGPL

Version

0.1

Dependencies
  • trivia (system).
  • alexandria (system).
  • iterate (system).
  • lisp-namespace (system).
Source

constantfold.asd.

Child Component

package.lisp (file).


3 Files

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


3.1 Lisp


3.1.1 constantfold/constantfold.asd

Source

constantfold.asd.

Parent Component

constantfold (system).

ASDF Systems

constantfold.


3.1.2 constantfold/package.lisp

Source

constantfold.asd.

Parent Component

constantfold (system).

Packages

constantfold.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 constantfold

Source

package.lisp.

Use List
  • alexandria.
  • common-lisp.
  • iterate.
  • lisp-namespace.
  • trivia.level2.
Public Interface
Internals

5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: constantfold (name &key commutative associative copier)

Registers a constant folding compiler macros to the function NAME.

Package

constantfold.

Source

package.lisp.


5.1.2 Ordinary functions

Function: unfold (name)

Unregister the compiler macro

Package

constantfold.

Source

package.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *constant-form-doc-table*
Package

constantfold.

Source

package.lisp.

Special Variable: *constant-form-table*
Package

constantfold.

Source

package.lisp.


5.2.2 Compiler macros

Compiler Macro: foldable-associative-fn (&rest args)

Performs constant-folding for associative functions. Following optimization is performed:

(+ a 2 3 b) –> (+ a (+ 2 3) b) –> (+ a 5 b)

Package

constantfold.

Source

package.lisp.

Compiler Macro: foldable-commutative-associative-fn (&rest args)

Performs constant-folding for commutative and associative functions. Following optimization is performed:

(+ a 2 3 b 1) –> (+ (+ 2 3 1) a b) –> (+ 6 a b)

Package

constantfold.

Source

package.lisp.

Compiler Macro: foldable-fn (&rest args)

Performs a simple constant-folding. Constantfold when all arguments are constants.

Package

constantfold.

Source

package.lisp.


5.2.3 Ordinary functions

Function: %foldable-associative-fn (whole env)
Package

constantfold.

Source

package.lisp.

Function: %foldable-commutative-associative-fn (whole env)
Package

constantfold.

Source

package.lisp.

Function: %foldable-fn (whole args env)
Package

constantfold.

Source

package.lisp.

Function: compiler-macro-form-name (whole)

Extracts the name of the function from the &whole argument of a compiler macro.

Package

constantfold.

Source

package.lisp.

Function: constant-form-boundp (symbol)

Automatically defined boolean function.

Package

constantfold.

Source

package.lisp.

Function: constant-form-copier (name)
Package

constantfold.

Source

package.lisp.

Function: constant-form-p (form &optional env)

Recursively checks if the form is a constant form.
Returns a boolean. When FORM is a standard constant form reconized by constantp, it also returns T as the secondary value.

Package

constantfold.

Source

package.lisp.

Function: evaluate-constants (name args)
Package

constantfold.

Source

package.lisp.

Function: flatten-associative-nested-fn (form)

Flattens a tree of forms of the same functions. For example, (+ (+ 2 3) (+ 5 6)) into (+ 2 3 5 6).

Package

constantfold.

Source

package.lisp.

Function: register-constant-form (name &optional copier)
Package

constantfold.

Source

package.lisp.

Function: symbol-constant-form (symbol &optional default)

Automatically defined getter function. When DEFAULT is supplied, the value is set automatically.

Package

constantfold.

Source

package.lisp.

Function: (setf symbol-constant-form) (symbol)

Automatically defined setter function.

Package

constantfold.

Source

package.lisp.

Function: wrap-inline (name form)

Allows further calls to the compiler macro.

Package

constantfold.

Source

package.lisp.

Function: wrap-notinline (name form)

Suppresses further calls to the compiler macro which otherwise causes an infinite loop.

Package

constantfold.

Source

package.lisp.


5.2.4 Conditions

Condition: unbound-constant-form
Package

constantfold.

Source

package.lisp.

Direct superclasses

unbound-variable.


5.2.5 Types

Type: constant-form-type ()
Package

constantfold.

Source

package.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
C   E   F   M   R   S   U   W  
Index Entry  Section

%
%foldable-associative-fn: Private ordinary functions
%foldable-commutative-associative-fn: Private ordinary functions
%foldable-fn: Private ordinary functions

(
(setf symbol-constant-form): Private ordinary functions

C
Compiler Macro, foldable-associative-fn: Private compiler macros
Compiler Macro, foldable-commutative-associative-fn: Private compiler macros
Compiler Macro, foldable-fn: Private compiler macros
compiler-macro-form-name: Private ordinary functions
constant-form-boundp: Private ordinary functions
constant-form-copier: Private ordinary functions
constant-form-p: Private ordinary functions
constantfold: Public macros

E
evaluate-constants: Private ordinary functions

F
flatten-associative-nested-fn: Private ordinary functions
foldable-associative-fn: Private compiler macros
foldable-commutative-associative-fn: Private compiler macros
foldable-fn: Private compiler macros
Function, %foldable-associative-fn: Private ordinary functions
Function, %foldable-commutative-associative-fn: Private ordinary functions
Function, %foldable-fn: Private ordinary functions
Function, (setf symbol-constant-form): Private ordinary functions
Function, compiler-macro-form-name: Private ordinary functions
Function, constant-form-boundp: Private ordinary functions
Function, constant-form-copier: Private ordinary functions
Function, constant-form-p: Private ordinary functions
Function, evaluate-constants: Private ordinary functions
Function, flatten-associative-nested-fn: Private ordinary functions
Function, register-constant-form: Private ordinary functions
Function, symbol-constant-form: Private ordinary functions
Function, unfold: Public ordinary functions
Function, wrap-inline: Private ordinary functions
Function, wrap-notinline: Private ordinary functions

M
Macro, constantfold: Public macros

R
register-constant-form: Private ordinary functions

S
symbol-constant-form: Private ordinary functions

U
unfold: Public ordinary functions

W
wrap-inline: Private ordinary functions
wrap-notinline: Private ordinary functions