The cl-splicing-macro Reference Manual

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

The cl-splicing-macro Reference Manual

This is the cl-splicing-macro Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:03:20 2022 GMT+0.

Table of Contents


1 Introduction

cl-splicing-macro

Features of this package are defmacro-enhance useable! (I.e. in DEFMACRO! from DEFMACRO-ENHANCE system both sampling expansion and splicing expansion can be used)

This package adds a possibility for macros to inject several forms (not just one) into surrounding macros's body.

CL-SPLICING-MACRO> (defmacro bar (&rest things)
                     "Just a toy macros, that expands into a PLUS"
                     `(+ ,@things))
CL-SPLICING-MACRO> (define-maybe-splicing-macro foo (a b &sample (1 2))
                     "Just a toy macro that will splice in the body of surrounding macro."
                     `(sprogn ,a ,b))
CL-SPLICING-MACRO> (macroexpand-1 '(bar 1 2 (foo 3 4) 5 6))
(+ 1 2 3 4 5 6) ; enjoy!

Sampling macroexpansion

Whether a given macros is splicing or not is decided on basis of whether its expansion contains SPROGN in CAR-position, or not. For this to work, we need a "characteristic expansion" of this macros, or a "testing expansion".

New magic word &SAMPLE in macro-lambda-list is used to provide parameters of a macro, that result in generic-enough expansion (against which checks on the structure of the expansion can be made).

Sampling expansion for a given macros, if present, can be obtained with help of TESTING-EXPANSION macros.

CL-SPLICING-MACRO> (define-maybe-sampling-macro my-macro (a &sample (qwerty))
                     ...) ; define-my-clever-macro
CL-SPLICING-MACRO> (if (indeed-clever-expansion-p (testing-expansion my-macro))
                       do-something-useful)

By default, DEFINE-MAYBE-SAMPLING-MACRO is a wrapper around plain DEFMACRO, but DEFINE-/SAMPLING! macro-construction macros can be used to add sampling feature to your favorite DEFMACRO-like operator (e.g. DEFMACRO! from Let-Over-Lambda).

CL-SPLICING-MACRO> (define-/sampling! def-my-fav-macro-sampling def-my-fav-macro)

2 Systems

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


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

2.1 cl-splicing-macro

Deforms macros in a way, that they can capture surrounding s-exps for their expansion.

Author

Alexandr Popolitov <popolit@gmail.com>

License

GPL

Version

0.1

Source

cl-splicing-macro.asd.

Child Components

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   [Contents][Index]

3.1.1 cl-splicing-macro/cl-splicing-macro.asd

Source

cl-splicing-macro.asd.

Parent Component

cl-splicing-macro (system).

ASDF Systems

cl-splicing-macro.


3.1.2 cl-splicing-macro/package.lisp

Source

cl-splicing-macro.asd.

Parent Component

cl-splicing-macro (system).

Packages

cl-splicing-macro.


3.1.3 cl-splicing-macro/sbcl.lisp

Dependency

package.lisp (file).

Source

cl-splicing-macro.asd.

Parent Component

cl-splicing-macro (system).


3.1.4 cl-splicing-macro/cl-splicing-macro.lisp

Dependency

sbcl.lisp (file).

Source

cl-splicing-macro.asd.

Parent Component

cl-splicing-macro (system).

Public Interface
Internals

3.1.5 cl-splicing-macro/sbcl-2.lisp

Dependency

cl-splicing-macro.lisp (file).

Source

cl-splicing-macro.asd.

Parent Component

cl-splicing-macro (system).


4 Packages

Packages are listed by definition order.


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

4.1 cl-splicing-macro

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

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


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

5.1 Public Interface


5.1.1 Macros

Macro: define-/sampling! (src-name dst-name)

Define macro SRC-NAME on top of DST-NAME.
Adds possibility to specify sample macroexpansion data, via &SAMPLE magic word in ARGS. Expects ARGS list to contain ARGS variable, which contains lambda-list.

Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Macro: define-/splicing! (src-name dst-name)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Macro: define-maybe-sampling-macro (name args &body body)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Macro: define-maybe-splicing-macro (name lambda-list &body body)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Macro: disable-splicing-macro ()
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Macro: enable-splicing-macro ()
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Macro: sprogn (&rest forms)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Macro: testing-expansion (name)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Macro: with-splicing-macro-runtime (&body body)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.


5.2 Internals


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

5.2.1 Special variables

Special Variable: *sample-expansion-data*
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Special Variable: *splicing-macro*
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.


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

5.2.2 Ordinary functions

Function: %disable-splicing-macro ()
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Function: %enable-splicing-macro ()
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Function: ampersand-symbol-p (sym)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Function: mk-splicing-macroexpand-hook (old-macroexpand-hook)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.

Function: parse-sample-from-lambda-list (lst)
Package

cl-splicing-macro.

Source

cl-splicing-macro.lisp.


Appendix A Indexes


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

A.1 Concepts


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

A.2 Functions

Jump to:   %  
A   D   E   F   M   P   S   T   W  
Index Entry  Section

%
%disable-splicing-macro: Private ordinary functions
%enable-splicing-macro: Private ordinary functions

A
ampersand-symbol-p: Private ordinary functions

D
define-/sampling!: Public macros
define-/splicing!: Public macros
define-maybe-sampling-macro: Public macros
define-maybe-splicing-macro: Public macros
disable-splicing-macro: Public macros

E
enable-splicing-macro: Public macros

F
Function, %disable-splicing-macro: Private ordinary functions
Function, %enable-splicing-macro: Private ordinary functions
Function, ampersand-symbol-p: Private ordinary functions
Function, mk-splicing-macroexpand-hook: Private ordinary functions
Function, parse-sample-from-lambda-list: Private ordinary functions

M
Macro, define-/sampling!: Public macros
Macro, define-/splicing!: Public macros
Macro, define-maybe-sampling-macro: Public macros
Macro, define-maybe-splicing-macro: Public macros
Macro, disable-splicing-macro: Public macros
Macro, enable-splicing-macro: Public macros
Macro, sprogn: Public macros
Macro, testing-expansion: Public macros
Macro, with-splicing-macro-runtime: Public macros
mk-splicing-macroexpand-hook: Private ordinary functions

P
parse-sample-from-lambda-list: Private ordinary functions

S
sprogn: Public macros

T
testing-expansion: Public macros

W
with-splicing-macro-runtime: Public macros

Jump to:   %  
A   D   E   F   M   P   S   T   W