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.
The main system appears first, followed by any subsystem dependency.
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.
Marco Antoniotti
BSD
definer-pkg.lisp
(file).
definer.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
definer/definer.lisp
definer-pkg.lisp
(file).
definer
(system).
build-definition-form
(generic function).
def
(macro).
type-specifier-p
(function).
Packages are listed by definition order.
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.
cl.ext.syntax.definer
definer
def
defn
common-lisp
.
build-definition-form
(generic function).
def
(macro).
type-specifier-p
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
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.
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
list
) name definition-forms &optional prefix-options) ¶(eql it.unimib.disco.ma.cl.ext.syntax.definer:modify-macro)
) (mm-name symbol
) mm-def-body &optional prefix-options) ¶(eql it.unimib.disco.ma.cl.ext.syntax.definer:setf-expander)
) (accessor-fn symbol
) setfexp-def-body &optional prefix-options) ¶(eql setf)
) (accessor-fn symbol
) defsetf-def-body &optional prefix-options) ¶(eql method-combination)
) (mcn symbol
) mc-def-body &optional prefix-options) ¶(eql condition)
) (condition-name symbol
) cnd-def-body &optional prefix-options) ¶(eql package)
) (package-name symbol
) definition-forms &optional prefix-options) ¶(eql type)
) (type-name symbol
) definition-forms &optional prefix-options) ¶(eql it.unimib.disco.ma.cl.ext.syntax.definer:definer)
) (for-what symbol
) definition-forms &optional prefix-options) ¶(eql structure)
) (name symbol
) definition-forms &optional prefix-options) ¶(eql it.unimib.disco.ma.cl.ext.syntax.definer:constant)
) (name symbol
) definition-forms &optional prefix-options) ¶(eql it.unimib.disco.ma.cl.ext.syntax.definer:parameter)
) (name symbol
) definition-forms &optional prefix-options) ¶(eql it.unimib.disco.ma.cl.ext.syntax.definer:var)
) (name symbol
) definition-forms &optional prefix-options) ¶(eql class)
) (name symbol
) definition-forms &optional prefix-options) ¶(eql method)
) (name symbol
) definition-forms &optional prefix-options) ¶(eql it.unimib.disco.ma.cl.ext.syntax.definer:generic)
) (name symbol
) definition-forms &optional prefix-options) ¶(eql it.unimib.disco.ma.cl.ext.syntax.definer:macro)
) (name symbol
) definition-forms &optional prefix-options) ¶(eql function)
) (name symbol
) definition-forms &optional prefix-options) ¶Jump to: | B D F G M T |
---|
Jump to: | B D F G M T |
---|
Jump to: | D F I P S |
---|
Jump to: | D F I P S |
---|