The definer Reference Manual

This is the definer Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 05:01:00 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 definer

A DEF macro for Common Lisp.

The DEFINER library adds a simple macro DEF to Common Lisp that replaces the various ’def*’ forms in the language. It is a simple hack, but it adds some elegance to the language. Of course, it comes with its own way to be extended.

Author

Marco Antoniotti

License

BSD

Source

definer.asd.

Child Components

3 Files

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


3.1 Lisp


3.1.1 definer/definer.asd

Source

definer.asd.

Parent Component

definer (system).

ASDF Systems

definer.


3.1.2 definer/definer-pkg.lisp

Source

definer.asd.

Parent Component

definer (system).

Packages

it.unimib.disco.ma.cl.ext.syntax.definer.


3.1.3 definer/definer.lisp

Dependency

definer-pkg.lisp (file).

Source

definer.asd.

Parent Component

definer (system).

Public Interface
Internals

type-specifier-p (function).


4 Packages

Packages are listed by definition order.


4.1 it.unimib.disco.ma.cl.ext.syntax.definer

The CL Extensions Definer Package.

The package contains a simple extension to Common Lisp by introducing a simple DEF macro.

Notes:

The package name is long because it indicates how to position the library functionality within the breakdown in chapters of the ANSI specification.

The "CL.EXT.SYNTAX.DEFINER" nickname is provided as a suggestion about how to ’standardize’ package names according to a meaninguful scheme.

Source

definer-pkg.lisp.

Nicknames
  • cl.ext.syntax.definer
  • definer
  • def
  • defn
Use List

common-lisp.

Public Interface
Internals

type-specifier-p (function).


5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: def (what name &rest definition-forms)

Expands into the appropriate definition form for WHAT.

The macro eventually calls BUILD-DEFINITION-FORM to construct the
proper definition form for NAME. WHAT directs the underlying form
builder code in a method of BUILD-DEFINITION-FORM to produce the appropriate RESULT.

NAME can be processed to produce the actual ’name’ of the object being defined.

The actual contents of DEFINITION-FORMS depend on WHAT is being
defined.

Arguments and Values:

WHAT : a SYMBOL or a CONS
NAME : a SYMBOL or a CONS
DEFINITION-FORMS : a ’compound form’
result : a T (depends on WHAT is being defined)

Examples:

cl-prompt> (def function fact (x) (if (zerop x) 1 (* x (fact (1- x))))) FACT

cl-prompt> (def macro foo (y) ‘(list ,y 42))
FOO

cl-prompt> (def method bar :before ((x symbol)) ...)
#<STANDARD-METHOD bar (:BEFORE) (SYMBOL) 200A9D33>

;;; When WHAT is the symbol ’definer’ the form has the following
;;; syntax:

def definer what (&key type-of-naming-form name body-name) &body definer-forms
;;; WHAT is a symbol or a cons. TYPE-OF-NAMING-FORM the symbol
;;; ’symbol’, or the symbol ’cons’ (or some other type specifier); the
;;; default is ’symbol’. NAME a symbol that is used within the body
;;; DEFINER-FORMS to retrieve the name of the object being defined;
;;; the default is the symbol ’name’. BODY-NAME a symbol that is used
;;; within the body DEFINER-FORMS to retrieve the actual definition
;;; forms for the definer; the default is the symbol
;;; ’definition-forms’. DEFINER-FORMS is a compound form.
;;;
;;; In this case the DEF macro behaves as follows. A
;;; BUILD-DEFINITION-FORM method on NAME is defined. The keyword
;;; parameters that can be passed to the DEF are meant to ease the
;;; writing of DEFINER-FORMS.

;;; TYPE-OF-NAMING-FORM is used in a DECLARE form to aid the compiler.
;;; NAME-VAR is a symbol that is used within the body DEFINER-FORMS to
;;; retrieve the name of the object being defined.

Side Effects:

NAME is defined as a WHAT in the environment. ’WHAT’ is defined (pun intended!) depends on the current set of methods for the generic
function BUILD-DEFINITION-FORM.

Package

it.unimib.disco.ma.cl.ext.syntax.definer.

Source

definer.lisp.


5.1.2 Generic functions

Generic Function: build-definition-form (what name definition-forms &optional prefix-options)

Constructs the actual ’definition form’ based on the arguments received.
The methods of this generic function are called by the DEF macro to perform the eventual expansion of the definition.

The optional parameter PREFIX-options can be used to pass around extra information - usually, but not necessarily, in the form of a list of symbols - when WHAT, or NAME is a structured, non-symbol, object.

Arguments and Values:

WHAT : a T (actually a S-expr)
NAME : a SYMBOL
DEFINITION-FORMS : a FORM
PREFIX-OPTIONS : a T (actually a S-expr)
result : a FORM

Examples:

;;; A simple, straightforward (and useless?) example is the following:
(defmethod build-definition-form ((what (eql ’parameter))
(name symbol) definition-forms
&optional prefix-options) ‘(defparameter ,name ,@definition-forms))

;;; Given the definition above, now we can do:

cl-prompt> (def parameter *qd* 42 "The answer.")
*QD*

cl-prompt> *qd*
42

Package

it.unimib.disco.ma.cl.ext.syntax.definer.

Source

definer.lisp.

Methods
Method: build-definition-form ((what list) name definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql it.unimib.disco.ma.cl.ext.syntax.definer:modify-macro)) (mm-name symbol) mm-def-body &optional prefix-options)
Method: build-definition-form ((what (eql it.unimib.disco.ma.cl.ext.syntax.definer:setf-expander)) (accessor-fn symbol) setfexp-def-body &optional prefix-options)
Method: build-definition-form ((what (eql setf)) (accessor-fn symbol) defsetf-def-body &optional prefix-options)
Method: build-definition-form ((what (eql method-combination)) (mcn symbol) mc-def-body &optional prefix-options)
Method: build-definition-form ((what (eql condition)) (condition-name symbol) cnd-def-body &optional prefix-options)
Method: build-definition-form ((what (eql package)) (package-name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql type)) (type-name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql it.unimib.disco.ma.cl.ext.syntax.definer:definer)) (for-what symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql structure)) (name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql it.unimib.disco.ma.cl.ext.syntax.definer:constant)) (name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql it.unimib.disco.ma.cl.ext.syntax.definer:parameter)) (name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql it.unimib.disco.ma.cl.ext.syntax.definer:var)) (name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql class)) (name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql method)) (name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql it.unimib.disco.ma.cl.ext.syntax.definer:generic)) (name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql it.unimib.disco.ma.cl.ext.syntax.definer:macro)) (name symbol) definition-forms &optional prefix-options)
Method: build-definition-form ((what (eql function)) (name symbol) definition-forms &optional prefix-options)

5.2 Internals


5.2.1 Ordinary functions

Function: type-specifier-p (x)
Package

it.unimib.disco.ma.cl.ext.syntax.definer.

Source

definer.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   B   D   F   G   M   T  
Index Entry  Section

B
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions
build-definition-form: Public generic functions

D
def: Public macros

F
Function, type-specifier-p: Private ordinary functions

G
Generic Function, build-definition-form: Public generic functions

M
Macro, def: Public macros
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions
Method, build-definition-form: Public generic functions

T
type-specifier-p: Private ordinary functions


A.3 Variables