The definer Reference Manual

Table of Contents

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

The definer Reference Manual

This is the definer Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 15:52:46 2021 GMT+0.


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

1 Introduction

DEFINER

Marco Antoniotti (c) 2004-2021

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.

A NOTE ON FORKING

Of course you are free to fork the project subject to the current licensing scheme. However, before you do so, I ask you to consider plain old "cooperation" by asking me to become a developer. It helps keeping the entropy at an acceptable level.

Enjoy.


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 definer

Author

Marco Antoniotti

License

BSD

Description

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.

Source

definer.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 definer.asd

Location

definer.asd

Systems

definer (system)


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

3.1.2 definer/definer-pkg.lisp

Parent

definer (system)

Location

definer-pkg.lisp

Packages

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


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

3.1.3 definer/definer.lisp

Dependency

definer-pkg.lisp (file)

Parent

definer (system)

Location

definer.lisp

Exported Definitions
Internal Definitions

type-specifier-p (function)


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

4 Packages

Packages are listed by definition order.


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

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 (file)

Nicknames
Use List

common-lisp

Exported Definitions
Internal Definitions

type-specifier-p (function)


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 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 (file)


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

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 (file)

Methods
Method: build-definition-form (WHAT list) NAME DEFINITION-FORMS &optional PREFIX-OPTIONS
Method: build-definition-form (WHAT (eql modify-macro)) (MM-NAME symbol) MM-DEF-BODY &optional PREFIX-OPTIONS
Method: build-definition-form (WHAT (eql 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 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 constant)) (NAME symbol) DEFINITION-FORMS &optional PREFIX-OPTIONS
Method: build-definition-form (WHAT (eql parameter)) (NAME symbol) DEFINITION-FORMS &optional PREFIX-OPTIONS
Method: build-definition-form (WHAT (eql 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 generic)) (NAME symbol) DEFINITION-FORMS &optional PREFIX-OPTIONS
Method: build-definition-form (WHAT (eql macro)) (NAME symbol) DEFINITION-FORMS &optional PREFIX-OPTIONS
Method: build-definition-form (WHAT (eql function)) (NAME symbol) DEFINITION-FORMS &optional PREFIX-OPTIONS

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

5.2 Internal definitions


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

5.2.1 Functions

Function: type-specifier-p X
Package

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

Source

definer.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   D   F   L  
Index Entry  Section

D
definer.asd: The definer․asd file
definer/definer-pkg.lisp: The definer/definer-pkg․lisp file
definer/definer.lisp: The definer/definer․lisp file

F
File, Lisp, definer.asd: The definer․asd file
File, Lisp, definer/definer-pkg.lisp: The definer/definer-pkg․lisp file
File, Lisp, definer/definer.lisp: The definer/definer․lisp file

L
Lisp File, definer.asd: The definer․asd file
Lisp File, definer/definer-pkg.lisp: The definer/definer-pkg․lisp file
Lisp File, definer/definer.lisp: The definer/definer․lisp file

Jump to:   D   F   L  

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

A.2 Functions

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

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

D
def: Exported macros

F
Function, type-specifier-p: Internal functions

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

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

T
type-specifier-p: Internal functions

Jump to:   B   D   F   G   M   T  

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

A.3 Variables


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

A.4 Data types

Jump to:   D   I   P   S  
Index Entry  Section

D
definer: The definer system

I
it.unimib.disco.ma.cl.ext.syntax.definer: The it․unimib․disco․ma․cl․ext․syntax․definer package

P
Package, it.unimib.disco.ma.cl.ext.syntax.definer: The it․unimib․disco․ma․cl․ext․syntax․definer package

S
System, definer: The definer system

Jump to:   D   I   P   S