The restricted-functions Reference Manual

This is the restricted-functions Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 06:47:12 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 restricted-functions

Reasoning about functions with restricted argument types.

Author

Marco Heisig <>

License

MIT

Dependencies
  • alexandria (system).
  • closer-mop (system).
  • simplified-types (system).
  • trivia (system).
  • trivial-arguments (system).
  • trivial-garbage (system).
Source

restricted-functions.asd.

Child Components

3 Modules

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


3.1 restricted-functions/type-inference-rules

Dependency

default-methods.lisp (file).

Source

restricted-functions.asd.

Parent Component

restricted-functions (system).

Child Component

numbers.lisp (file).


4 Files

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


4.1 Lisp


4.1.1 restricted-functions/restricted-functions.asd

Source

restricted-functions.asd.

Parent Component

restricted-functions (system).

ASDF Systems

restricted-functions.


4.1.2 restricted-functions/packages.lisp

Source

restricted-functions.asd.

Parent Component

restricted-functions (system).

Packages

restricted-functions.


4.1.3 restricted-functions/function-lambda-lists.lisp

Dependency

packages.lisp (file).

Source

restricted-functions.asd.

Parent Component

restricted-functions (system).

Internals

4.1.4 restricted-functions/generic-functions.lisp

Dependency

function-lambda-lists.lisp (file).

Source

restricted-functions.asd.

Parent Component

restricted-functions (system).

Public Interface

4.1.6 restricted-functions/restricted-function.lisp

Dependency

strategies.lisp (file).

Source

restricted-functions.asd.

Parent Component

restricted-functions (system).

Public Interface
Internals

4.1.7 restricted-functions/default-methods.lisp

Dependency

restricted-function.lisp (file).

Source

restricted-functions.asd.

Parent Component

restricted-functions (system).

Public Interface

4.1.8 restricted-functions/type-inference-rules/numbers.lisp

Source

restricted-functions.asd.

Parent Component

type-inference-rules (module).

Internals

5 Packages

Packages are listed by definition order.


5.1 restricted-functions

Source

packages.lisp.

Use List

closer-common-lisp.

Public Interface
Internals

6 Definitions

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


6.1 Public Interface


6.1.1 Generic functions

Generic Function: argument-types (function)

Returns a list of the types of all mandatory arguments of FUNCTION.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: argument-types ((function function))
Source

default-methods.lisp.

Generic Function: arity (function)

Returns the number of arguments of FUNCTION.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: arity ((function function))
Source

default-methods.lisp.

Method: arity ((rf restricted-function))
Source

restricted-function.lisp.

Generic Function: function-type (function)

Returns a type specifier describing FUNCTION.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: function-type ((function function))
Source

default-methods.lisp.

Generic Function: infer-type (strategy function &rest argument-types)

Returns a values type specifier, describing the possible values of FUNCTION when called with arguments of the given ARGUMENT-TYPES.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: infer-type (strategy (function function) &rest argument-types)
Source

default-methods.lisp.

Method: infer-type ((strategy null) (function function) &rest argument-types)
Source

default-methods.lisp.

Method: infer-type ((strategy default-type-inference) (function function) &rest argument-types)
Source

strategies.lisp.

Method: infer-type :around ((strategy argument-type-simplification-around-infer-type) (function function) &rest argument-types)
Source

strategies.lisp.

Generic Function: mandatory-values (function)

Returns the number of mandatory values returned by FUNCTION.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: mandatory-values ((function function))
Source

default-methods.lisp.

Reader Method: mandatory-values ((restricted-function restricted-function))

automatically generated reader method

Source

restricted-function.lisp.

Target Slot

%mandatory-values.

Generic Reader: name (function)

Returns a symbol that is the name of FUNCTION.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Reader Method: name ((restricted-function restricted-function))

automatically generated reader method

Source

restricted-function.lisp.

Target Slot

%name.

Generic Function: nth-argument-type (n function)

Returns a type specifier that describes the set of permissible values for the Nth argument of FUNCTION.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: nth-argument-type ((n integer) (function function))
Source

default-methods.lisp.

Method: nth-argument-type ((n integer) (rf restricted-function))
Source

restricted-function.lisp.

Generic Function: nth-value-type (n function)

Returns a type specifier that describes the Nth value returned by FUNCTION.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: nth-value-type ((n integer) (function function))
Source

default-methods.lisp.

Method: nth-value-type ((n integer) (rf restricted-function))
Source

restricted-function.lisp.

Generic Function: optional-values (function)

Returns the number of optional values returned by FUNCTION.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: optional-values ((function function))
Source

default-methods.lisp.

Reader Method: optional-values ((restricted-function restricted-function))

automatically generated reader method

Source

restricted-function.lisp.

Target Slot

%optional-values.

Generic Function: original-function (function)

Returns the function upon which FUNCTION specializes.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: original-function ((function function))
Source

default-methods.lisp.

Reader Method: original-function ((restricted-function restricted-function))

automatically generated reader method

Source

restricted-function.lisp.

Target Slot

%original-function.

Generic Function: rest-values-p (function)

Returns whether FUNCTION may return any number of values.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: rest-values-p ((function function))
Source

default-methods.lisp.

Reader Method: rest-values-p ((restricted-function restricted-function))

automatically generated reader method

Source

restricted-function.lisp.

Target Slot

%rest-values-p.

Generic Function: restrict (strategy function &rest argument-types)

Returns a restricted function that is equivalent to FUNCTION, but only applicable to arguments of the given ARGUMENT-TYPES. This restricted function can the either be called directly, or queried for a variety of information, such as the type of the values it returns. Internally, RESTRICT calls INFER-TYPE on the same arguments to determine the type of the possible values of FUNCTION.

The first argument, STRATEGY, influences how fast or precise type inference ought to be done, or whether to use caching or not. The default strategy (used when STRATEGY is NIL), simplifies all argument types before use and caches restricted functions unconditionally.

New strategies can be defined by the user by specializing on RESTRICT and INFER-TYPE.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: restrict (strategy (function function) &rest argument-types)
Source

default-methods.lisp.

Method: restrict ((strategy null) (function function) &rest argument-types)
Source

default-methods.lisp.

Method: restrict :around ((strategy restricted-function-caching) (function function) &rest argument-types)
Source

strategies.lisp.

Method: restrict :around ((strategy argument-type-simplification-around-restrict) (function function) &rest argument-types)
Source

strategies.lisp.

Generic Function: values-type (function)

Returns a values type specifier that describes the multiple values that will be returned when FUNCTION is called with valid arguments.

Package

restricted-functions.

Source

generic-functions.lisp.

Methods
Method: values-type ((function function))
Source

default-methods.lisp.


6.1.2 Standalone methods

Method: print-object ((rf restricted-function) stream)
Source

restricted-function.lisp.


6.1.3 Classes

Class: argument-type-simplification-around-infer-type
Package

restricted-functions.

Source

strategies.lisp.

Direct subclasses

default-strategy-for-infer-type.

Direct methods

infer-type.

Class: argument-type-simplification-around-restrict
Package

restricted-functions.

Source

strategies.lisp.

Direct subclasses

default-strategy-for-restrict.

Direct methods

restrict.

Class: default-type-inference
Package

restricted-functions.

Source

strategies.lisp.

Direct subclasses
Direct methods

infer-type.

Class: restricted-function
Package

restricted-functions.

Source

restricted-function.lisp.

Direct superclasses

funcallable-standard-object.

Direct methods
Direct slots
Slot: %name
Initargs

:name

Readers

name.

Writers

This slot is read-only.

Slot: %original-function
Initargs

:original-function

Readers

original-function.

Writers

This slot is read-only.

Slot: %mandatory-values
Initargs

:mandatory-values

Readers

mandatory-values.

Writers

This slot is read-only.

Slot: %optional-values
Initargs

:optional-values

Readers

optional-values.

Writers

This slot is read-only.

Slot: %rest-values-p
Initargs

:rest-values-p

Readers

rest-values-p.

Writers

This slot is read-only.

Slot: %atypes
Type

simple-vector

Initargs

:atypes

Readers

atypes.

Writers

This slot is read-only.

Slot: %rtypes
Type

simple-vector

Initargs

:rtypes

Readers

rtypes.

Writers

This slot is read-only.

Class: restricted-function-caching
Package

restricted-functions.

Source

strategies.lisp.

Direct subclasses

default-strategy-for-restrict.

Direct methods
Direct slots
Slot: %cache
Initform

(make-hash-table :test (function equal))

Readers

restricted-function-cache.

Writers

This slot is read-only.


6.2 Internals


6.2.1 Special variables

Special Variable: *default-strategy-for-infer-type*
Package

restricted-functions.

Source

strategies.lisp.

Special Variable: *default-strategy-for-restrict*
Package

restricted-functions.

Source

strategies.lisp.

Special Variable: *type-inference-functions*
Package

restricted-functions.

Source

strategies.lisp.


6.2.2 Macros

Macro: define-type-inference-rule (fname args &body body)
Package

restricted-functions.

Source

strategies.lisp.

Macro: type-inference-function (function)
Package

restricted-functions.

Source

strategies.lisp.


6.2.3 Ordinary functions

Function: bounded-integer-type-p (type)
Package

restricted-functions.

Source

numbers.lisp.

Function: check-arity (function number-of-supplied-arguments)
Package

restricted-functions.

Source

function-lambda-lists.lisp.

Function: compute-compiler-macro-function (rf)
Package

restricted-functions.

Source

restricted-function.lisp.

Function: function-arity (function)
Package

restricted-functions.

Source

function-lambda-lists.lisp.

Function: function-lambda-list (function &optional errorp)

Return the lambda list of FUNCTION, or an approximation thereof.

Package

restricted-functions.

Source

function-lambda-lists.lisp.

Function: generate-restricted-function-name ()
Package

restricted-functions.

Source

restricted-function.lisp.

Function: genstring (&optional prefix)
Package

restricted-functions.

Source

restricted-function.lisp.

Function: lambda-list-arity (lambda-list)

Return two values:
1. the number of mandatory arguments
2. the maximal number of permissible arguments

Package

restricted-functions.

Source

function-lambda-lists.lisp.

Function: numeric-contagion (type-1 type-2)
Package

restricted-functions.

Source

numbers.lisp.

Function: numeric-contagion/atomic (type-1 type-2)
Package

restricted-functions.

Source

numbers.lisp.

Function: parse-number-type (type)
Package

restricted-functions.

Source

numbers.lisp.

Function: parse-values-type (values-type)
Package

restricted-functions.

Source

restricted-function.lisp.

Function: unparse-number-type (complexp atomic-type)
Package

restricted-functions.

Source

numbers.lisp.


6.2.4 Generic functions

Generic Reader: atypes (object)
Package

restricted-functions.

Methods
Reader Method: atypes ((restricted-function restricted-function))

automatically generated reader method

Source

restricted-function.lisp.

Target Slot

%atypes.

Generic Reader: restricted-function-cache (object)
Package

restricted-functions.

Methods
Reader Method: restricted-function-cache ((restricted-function-caching restricted-function-caching))

automatically generated reader method

Source

strategies.lisp.

Target Slot

%cache.

Generic Reader: rtypes (object)
Package

restricted-functions.

Methods
Reader Method: rtypes ((restricted-function restricted-function))

automatically generated reader method

Source

restricted-function.lisp.

Target Slot

%rtypes.


6.2.5 Classes

Class: default-strategy-for-infer-type
Package

restricted-functions.

Source

strategies.lisp.

Direct superclasses
Class: default-strategy-for-restrict
Package

restricted-functions.

Source

strategies.lisp.

Direct superclasses

Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   B   C   D   F   G   I   L   M   N   O   P   R   T   U   V  
Index Entry  Section

A
argument-types: Public generic functions
argument-types: Public generic functions
arity: Public generic functions
arity: Public generic functions
arity: Public generic functions
atypes: Private generic functions
atypes: Private generic functions

B
bounded-integer-type-p: Private ordinary functions

C
check-arity: Private ordinary functions
compute-compiler-macro-function: Private ordinary functions

D
define-type-inference-rule: Private macros

F
Function, bounded-integer-type-p: Private ordinary functions
Function, check-arity: Private ordinary functions
Function, compute-compiler-macro-function: Private ordinary functions
Function, function-arity: Private ordinary functions
Function, function-lambda-list: Private ordinary functions
Function, generate-restricted-function-name: Private ordinary functions
Function, genstring: Private ordinary functions
Function, lambda-list-arity: Private ordinary functions
Function, numeric-contagion: Private ordinary functions
Function, numeric-contagion/atomic: Private ordinary functions
Function, parse-number-type: Private ordinary functions
Function, parse-values-type: Private ordinary functions
Function, unparse-number-type: Private ordinary functions
function-arity: Private ordinary functions
function-lambda-list: Private ordinary functions
function-type: Public generic functions
function-type: Public generic functions

G
generate-restricted-function-name: Private ordinary functions
Generic Function, argument-types: Public generic functions
Generic Function, arity: Public generic functions
Generic Function, atypes: Private generic functions
Generic Function, function-type: Public generic functions
Generic Function, infer-type: Public generic functions
Generic Function, mandatory-values: Public generic functions
Generic Function, name: Public generic functions
Generic Function, nth-argument-type: Public generic functions
Generic Function, nth-value-type: Public generic functions
Generic Function, optional-values: Public generic functions
Generic Function, original-function: Public generic functions
Generic Function, rest-values-p: Public generic functions
Generic Function, restrict: Public generic functions
Generic Function, restricted-function-cache: Private generic functions
Generic Function, rtypes: Private generic functions
Generic Function, values-type: Public generic functions
genstring: Private ordinary functions

I
infer-type: Public generic functions
infer-type: Public generic functions
infer-type: Public generic functions
infer-type: Public generic functions
infer-type: Public generic functions

L
lambda-list-arity: Private ordinary functions

M
Macro, define-type-inference-rule: Private macros
Macro, type-inference-function: Private macros
mandatory-values: Public generic functions
mandatory-values: Public generic functions
mandatory-values: Public generic functions
Method, argument-types: Public generic functions
Method, arity: Public generic functions
Method, arity: Public generic functions
Method, atypes: Private generic functions
Method, function-type: Public generic functions
Method, infer-type: Public generic functions
Method, infer-type: Public generic functions
Method, infer-type: Public generic functions
Method, infer-type: Public generic functions
Method, mandatory-values: Public generic functions
Method, mandatory-values: Public generic functions
Method, name: Public generic functions
Method, nth-argument-type: Public generic functions
Method, nth-argument-type: Public generic functions
Method, nth-value-type: Public generic functions
Method, nth-value-type: Public generic functions
Method, optional-values: Public generic functions
Method, optional-values: Public generic functions
Method, original-function: Public generic functions
Method, original-function: Public generic functions
Method, print-object: Public standalone methods
Method, rest-values-p: Public generic functions
Method, rest-values-p: Public generic functions
Method, restrict: Public generic functions
Method, restrict: Public generic functions
Method, restrict: Public generic functions
Method, restrict: Public generic functions
Method, restricted-function-cache: Private generic functions
Method, rtypes: Private generic functions
Method, values-type: Public generic functions

N
name: Public generic functions
name: Public generic functions
nth-argument-type: Public generic functions
nth-argument-type: Public generic functions
nth-argument-type: Public generic functions
nth-value-type: Public generic functions
nth-value-type: Public generic functions
nth-value-type: Public generic functions
numeric-contagion: Private ordinary functions
numeric-contagion/atomic: Private ordinary functions

O
optional-values: Public generic functions
optional-values: Public generic functions
optional-values: Public generic functions
original-function: Public generic functions
original-function: Public generic functions
original-function: Public generic functions

P
parse-number-type: Private ordinary functions
parse-values-type: Private ordinary functions
print-object: Public standalone methods

R
rest-values-p: Public generic functions
rest-values-p: Public generic functions
rest-values-p: Public generic functions
restrict: Public generic functions
restrict: Public generic functions
restrict: Public generic functions
restrict: Public generic functions
restrict: Public generic functions
restricted-function-cache: Private generic functions
restricted-function-cache: Private generic functions
rtypes: Private generic functions
rtypes: Private generic functions

T
type-inference-function: Private macros

U
unparse-number-type: Private ordinary functions

V
values-type: Public generic functions
values-type: Public generic functions


A.4 Data types

Jump to:   A   C   D   F   G   M   N   P   R   S   T  
Index Entry  Section

A
argument-type-simplification-around-infer-type: Public classes
argument-type-simplification-around-restrict: Public classes

C
Class, argument-type-simplification-around-infer-type: Public classes
Class, argument-type-simplification-around-restrict: Public classes
Class, default-strategy-for-infer-type: Private classes
Class, default-strategy-for-restrict: Private classes
Class, default-type-inference: Public classes
Class, restricted-function: Public classes
Class, restricted-function-caching: Public classes

D
default-methods.lisp: The restricted-functions/default-methods․lisp file
default-strategy-for-infer-type: Private classes
default-strategy-for-restrict: Private classes
default-type-inference: Public classes

F
File, default-methods.lisp: The restricted-functions/default-methods․lisp file
File, function-lambda-lists.lisp: The restricted-functions/function-lambda-lists․lisp file
File, generic-functions.lisp: The restricted-functions/generic-functions․lisp file
File, numbers.lisp: The restricted-functions/type-inference-rules/numbers․lisp file
File, packages.lisp: The restricted-functions/packages․lisp file
File, restricted-function.lisp: The restricted-functions/restricted-function․lisp file
File, restricted-functions.asd: The restricted-functions/restricted-functions․asd file
File, strategies.lisp: The restricted-functions/strategies․lisp file
function-lambda-lists.lisp: The restricted-functions/function-lambda-lists․lisp file

G
generic-functions.lisp: The restricted-functions/generic-functions․lisp file

M
Module, type-inference-rules: The restricted-functions/type-inference-rules module

N
numbers.lisp: The restricted-functions/type-inference-rules/numbers․lisp file

P
Package, restricted-functions: The restricted-functions package
packages.lisp: The restricted-functions/packages․lisp file

R
restricted-function: Public classes
restricted-function-caching: Public classes
restricted-function.lisp: The restricted-functions/restricted-function․lisp file
restricted-functions: The restricted-functions system
restricted-functions: The restricted-functions package
restricted-functions.asd: The restricted-functions/restricted-functions․asd file

S
strategies.lisp: The restricted-functions/strategies․lisp file
System, restricted-functions: The restricted-functions system

T
type-inference-rules: The restricted-functions/type-inference-rules module