form fiddle
1.1.0A collection of utilities to destructure lambda forms.
Table of Contents
About Form-Fiddle
Often times I need to destructure a form definition in a macro. This is a set of simple utilities to help with that.
How To
There's individual functions to extract each part of a lambda-definition-form: function, name, qualifiers, lambda-list, body, declarations, docstring and the forms. You can get all in one with split-lambda-form
, or directly as a binding macro with with-destructured-lambda-form
.
(split-lambda-form '(defun lambda-body (lambda-form)
(cddr lambda-form)))
(with-destructured-lambda-form (:forms forms)
'(defmacro foo (bar)
(declare (ignore bar))
"Testing macro!"
(print "test!"))
forms)
See Also
- Lambda-Fiddle To destructure lambda-lists.
System Information
Definition Index
-
FORM-FIDDLE
- ORG.SHIRAKUMO.FORM-FIDDLE
No documentation provided.-
EXTERNAL FUNCTION LAMBDA-BODY
- LAMBDA-FORM
- &REST
Returns all BODY forms of the lambda-form. |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯v¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯| (function [name] qualifier* lambda-list [[docstring? | declaration*]] form*)
-
EXTERNAL FUNCTION LAMBDA-DECLARATIONS
- LAMBDA-FORM
- &REST
Returns the DECLARATIONS of the lambda-form, if any. v (function [name] qualifier* lambda-list [[docstring? | declaration*]] form*)
-
EXTERNAL FUNCTION LAMBDA-DOCSTRING
- LAMBDA-FORM
- &REST
Returns the DOCSTRING of the lambda-form, if any. v (function [name] qualifier* lambda-list [[docstring? | declaration*]] form*)
-
EXTERNAL FUNCTION LAMBDA-FORMS
- LAMBDA-FORM
- &REST
Returns the actual body forms of the lambda-form, if any. v (function [name] qualifier* lambda-list [[docstring? | declaration*]] form*)
-
EXTERNAL FUNCTION LAMBDA-FUNCTION
- LAMBDA-FORM
- &REST
Returns the defining FUNCTION of the lambda-form. v (function [name] qualifier* lambda-list [[docstring? | declaration*]] form*)
-
EXTERNAL FUNCTION LAMBDA-LAMBDA-LIST
- LAMBDA-FORM
- &REST
Returns the LAMBDA-LIST of the lambda-form. v (function [name] qualifier* lambda-list [[docstring? | declaration*]] form*)
-
EXTERNAL FUNCTION LAMBDA-NAME
- LAMBDA-FORM
- &REST
Returns the NAME of the lambda-form, if any. v (function [name] qualifier* lambda-list [[docstring? | declaration*]] form*)
-
EXTERNAL FUNCTION LAMBDA-QUALIFIERS
- LAMBDA-FORM
- &REST
Returns the QUALIFIERS of the lambda-form. v (function [name] qualifier* lambda-list [[docstring? | declaration*]] form*)
-
EXTERNAL FUNCTION SPLIT-BODY-OPTIONS
- BODY
- &REST
Parses the body into two separate lists of forms and options. This is found in some expressions like in the clause body of RESTART-CASE. BODY ::= OPTION* FORM* OPTION ::= KEYWORD EXPRESSION
-
EXTERNAL FUNCTION SPLIT-LAMBDA-FORM
- LAMBDA-FORM
- &REST
Returns all parts of a lambda-form as a list in the following order: FUNCTION NAME QUALIFIERS LAMBDA-LIST DOCSTRING DECLARATIONS FORMS
-
EXTERNAL MACRO WITH-BODY-OPTIONS
- BODY
- OTHER-OPTIONS
- &REST
- OPTIONS
- &REST
- FORM
- &BODY
- BODY-FORMS
- &REST
Destructures the body according to split-body-kargs. OTHER-OPTIONS will be bound to contain all the options that occur in the body but were not explicitly requested in OPTIONS. BODY will be bound to the remaining body forms. Each option in OPTIONS can be either a symbol or a list of symbol and default. The symbol is automatically converted to a keyword to match against the body options.
-
EXTERNAL MACRO WITH-DESTRUCTURED-LAMBDA-FORM
- &KEY
- FUNCTION
- NAME
- QUALIFIERS
- LAMBDA-LIST
- DOCSTRING
- DECLARATIONS
- FORMS
- &REST
- EXPRESSION
- &BODY
- BODY
- &REST
Destructures the given EXPRESSION into its lambda-form parts.