The lineva Reference Manual

This is the lineva Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 16:54:31 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 lineva

Linear evaluation macro system

Author

Li Dzangfan <>

License

GPLv3

Version

0.0.1

Source

lineva.asd.

Child Component

lineva.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 lineva/lineva.asd

Source

lineva.asd.

Parent Component

lineva (system).

ASDF Systems

lineva.


3.1.2 lineva/lineva.lisp

Source

lineva.asd.

Parent Component

lineva (system).

Packages

lineva.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 lineva

Package providing linear evaluation feature.

Source

lineva.lisp.

Nickname

la

Use List

common-lisp.

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: definst (keyword lambda-list &body body)

Define a instruction named KEYWORD. KEYWORD and LAMBDA-LIST correspond to instruction in ‘leva’:

(KEYWORD LAMBDA-LIST...)

i.e.

(:instruction ...)

the BODY is a code which yield real code that the instruction KEYWORD defined. Special symbol ‘$rest-code’ represents rest code of linear evaluation. If the first element of BODY is a ‘string’, it will be seen as ‘documentation’ of instruction KEYWORD. For example

(definst :println (thing)
"Print THING and newline."
‘(progn (princ ,thing) (terpri)
,$rest-code))

then

(la:leva (:println "Hello world!") (values))

will expand to

(progn (princ "Hello world!") (terpri) (values))

Package

lineva.

Source

lineva.lisp.

Macro: leva (&body body)

Evaluate every instruction in BODY sequentially. Every instruction has one of following form:

(:instruction-name ...)
:instruction-name [= (:instruction-name)]
compound-form

where compound-form can be any valid lisp form except the first two. For example

(la:leva
(:let (x 10) (y 20)) ; Define local variables :break ; Create breakpoint (list x y)) ; Any Lisp form

See ‘definst’ for more information about user-defined instruction-name. See ‘available-instructions’ for all defined instructions. Use ‘describe-instruction’ to get document of a instruction.

Package

lineva.

Source

lineva.lisp.


5.1.2 Ordinary functions

Function: available-instructions ()

Return all defined instructions.

Package

lineva.

Source

lineva.lisp.

Function: describe-instruction (keyword &optional stream)

Display documentation of KEYWORD.

Package

lineva.

Source

lineva.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *expander-document-table*

Documentation table of item in *expander-table*

Package

lineva.

Source

lineva.lisp.

Special Variable: *expander-table*

A table of code transformer, whose keys are symbols and values are function which has signature

(KEY REST-CODE OTHER-PARAMETERS) -> CODE

KEY is its corresponding symbol in the *evaluator-table*, REST-CODE is expanded code in linear evaluation. Take the following code for example:

((K₁ ...)
(K₂ ...)
(K₃ ...)
(K₄ ...))

the function corresponding to K₂ will receive code expanded from

((K₃ ...)
(K₄ ...))

as its REST-CODE. OTHER-PARAMETERS is a parameter list customized by user, which correspond to ... in the code above.

Package

lineva.

Source

lineva.lisp.

Special Variable: *rest-code-name*
Package

lineva.

Source

lineva.lisp.


5.2.2 Macros

Macro: always-eval (&body body)

Equal to

(eval-when (:compile-toplevel :load-toplevel :execute) ...)

Package

lineva.

Source

lineva.lisp.


5.2.3 Ordinary functions

Function: define-instruction (keyword docstring function)

Define a new instruction called KEYWORD with FUNCTION. If the instruction has been defined, the old definition will be ignored.

Package

lineva.

Source

lineva.lisp.

Function: extract-docstring (keyword lambda-list body)

Extract docstring and construct a better docstring by KEYWORD and LAMBDA-LIST.

Package

lineva.

Source

lineva.lisp.

Function: find-expander (symbol)

Find expander in *expander-table* by SYMBOL, signal a error if nothing is found.

Package

lineva.

Source

lineva.lisp.

Function: has-docstring-p (body)

Determine whether BODY has docstring.

Package

lineva.

Source

lineva.lisp.

Function: unary-p (list)

Return true if LIST is a list containing only one element.

Package

lineva.

Source

lineva.lisp.


Appendix A Indexes


A.1 Concepts