lambda fiddle
1.0.0A collection of functions to process lambda-lists.
Table of Contents
About Lambda-Fiddle
Lambda-fiddle is a collection of utilities to process lambda-lists. Mostly useful in contexts where you want a macro that uses lambda-lists in some fashion but need more precise processing.
How To
Included are --for each standard lambda-list part-- a remove-*-part
and *-lambda-var/s
function that remove the specified part or extract the associated variable/s, respectively. These are all based on the more generale collect-for-keyword
and exclude-for-keyword
functions that will scan the given lambda-list for the keyword and collect accordingly. The generalised functions may also be useful if you plan to include your own non-standard keywords.
(lambda-fiddle:remove-aux-part '(foo bar &key baz &aux (something else) altogether))
(lambda-fiddle:aux-lambda-vars '(foo bar &key baz &aux (something else) altogether))
Additionally, there is split-lambda-list
and its macro partner with-destructured-lambda-list
that split the lambda-list into all its parts and return/bind them accordingly, allowing for easy access.
(lambda-fiddle:split-lambda-list '(&whole wide world &key roles))
(lambda-fiddle:with-destructured-lambda-list (:required req) '(foo bar &optional baz)
req)
System Information
Definition Index
-
LAMBDA-FIDDLE
- ORG.SHIRAKUMO.LAMBDA-FIDDLE
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *LAMBDA-KEYWORDS*
List of all standard lambda-keywords.
-
EXTERNAL SPECIAL-VARIABLE *SINGLE-ARGUMENT-KEYWORDS*
List of all standard lambda-keywords that only allow one argument.
-
EXTERNAL FUNCTION AUX-LAMBDA-VARS
- LAMBDA-LIST
- &REST
Returns all auxiliary variables of the ordinary-lambda-list.
-
EXTERNAL FUNCTION BODY-LAMBDA-VAR
- LAMBDA-LIST
- &REST
Returns the body variable of the ordinary-lambda-list.
-
EXTERNAL FUNCTION COLLECT-FOR-KEYWORD
- KEYWORD
- LAMBDA-LIST
- &KEY
- SPANNING
- &REST
Returns a fresh list of elements listed after the KEYWORD in the lambda-list. If SPANNING is T, it includes everything up until the next keyword, otherwise only one token each.
-
EXTERNAL FUNCTION CONSTRUCT-LAMBDA-LIST
- &KEY
- WHOLE
- ENVIRONMENT
- REQUIRED
- OPTIONAL
- REST
- BODY
- KEY
- ALLOW-OTHER-KEYS
- AUX
- &REST
Construct a lambda-list out of the given parts.
-
EXTERNAL FUNCTION ENVIRONMENT-LAMBDA-VAR
- LAMBDA-LIST
- &REST
Returns the environment variable of the lambda-list
-
EXTERNAL FUNCTION EXCLUDE-FOR-KEYWORD
- KEYWORD
- LAMBDA-LIST
- &KEY
- SPANNING
- &REST
Returns a fresh lambda-list but without the parts identified by KEYWORD. If SPANNING is T, it excludes everything up until the next keyword, otherwise only one token each.
-
EXTERNAL FUNCTION EXTRACT-ALL-LAMBDA-VARS
- LAMBDA-LIST
- &REST
Extracts all variable bindings from the lambda-list, including the present-p ones.
-
EXTERNAL FUNCTION EXTRACT-LAMBDA-VARS
- LAMBDA-LIST
- &REST
Extracts the symbols that name the variables in the lambda-list.
-
EXTERNAL FUNCTION FLATTEN-LAMBDA-LIST
- LAMBDA-LIST
- &REST
Flattens the lambda-list by replacing all lists within it with their respective first symbol. This also properly flattens inner lambda-lists of macro-lambda-lists.
-
EXTERNAL FUNCTION FLATTEN-METHOD-LAMBDA-LIST
- LAMBDA-LIST
- &REST
Flattens the lambda-list by replacing all lists within it with their respective first symbol. Unlike FLATTEN-LAMBDA-LIST, this works for method lambda lists.
-
EXTERNAL FUNCTION KEY-LAMBDA-VARS
- LAMBDA-LIST
- &REST
Returns all keyword variables of the ordinary-lambda-list.
-
EXTERNAL FUNCTION LAMBDA-KEYWORD-P
- SYMBOL
- &REST
Returns the symbol if it is a lambda-keyword symbol (the &-options).
-
EXTERNAL FUNCTION OPTIONAL-LAMBDA-VARS
- LAMBDA-LIST
- &REST
Returns all optional variables of the ordinary-lambda-list.
-
EXTERNAL FUNCTION REMOVE-AUX-PART
- LAMBDA-LIST
- &REST
Returns a fresh lambda-list without the &aux part.
-
EXTERNAL FUNCTION REMOVE-BODY-PART
- LAMBDA-LIST
- &REST
Returns a fresh lambda-list without the &body part.
-
EXTERNAL FUNCTION REMOVE-ENVIRONMENT-PART
- LAMBDA-LIST
- &REST
Returns a fresh lambda-list without the &environment part.
-
EXTERNAL FUNCTION REMOVE-KEY-PART
- LAMBDA-LIST
- &REST
Returns a fresh lambda-list without the &key part (also removing &allow-other-keys if present).
-
EXTERNAL FUNCTION REMOVE-OPTIONAL-PART
- LAMBDA-LIST
- &REST
Returns a fresh lambda-list without the &optional part.
-
EXTERNAL FUNCTION REMOVE-REQUIRED-PART
- LAMBDA-LIST
- &REST
Returns a fresh lambda-list without the required variables part.
-
EXTERNAL FUNCTION REMOVE-REST-PART
- LAMBDA-LIST
- &REST
Returns a fresh lambda-list without the &rest part.
-
EXTERNAL FUNCTION REMOVE-WHOLE-PART
- LAMBDA-LIST
- &REST
Returns a fresh lambda-list without the &whole part.
-
EXTERNAL FUNCTION REQUIRED-LAMBDA-VARS
- LAMBDA-LIST
- &REST
Returns all required variables of the ordinary-lambda-list.
-
EXTERNAL FUNCTION REST-LAMBDA-VAR
- LAMBDA-LIST
- &REST
Returns the rest variable of the ordinary-lambda-list.
-
EXTERNAL FUNCTION SINGLE-ARGUMENT-KEYWORD-P
- SYMBOL
- &REST
Returns the symbol if it is a single-argument-keyword symbol.
-
EXTERNAL FUNCTION SPLIT-LAMBDA-LIST
- LAMBDA-LIST
- &REST
Splits the lambda-list into its individual definition parts. Returns a list of values as follows: ((REQUIRED*) WHOLE ENVIRONMENT (OPTIONAL*) REST BODY (KEY*) (AUX*))
-
EXTERNAL FUNCTION WHOLE-LAMBDA-VAR
- LAMBDA-LIST
- &REST
Returns the &whole variable of the lambda-list.
-
EXTERNAL MACRO WITH-DESTRUCTURED-LAMBDA-LIST
- &REST
- PARTS
- &KEY
- WHOLE
- ENVIRONMENT
- REQUIRED
- OPTIONAL
- REST
- BODY
- KEY
- AUX
- &ALLOW-OTHER-KEYS
- &REST
- EXPRESSION
- &BODY
- FORMS
- &REST
Destructures the given EXPRESSION into its lambda-list parts.