Macros
The macros the bootstrap defines. Each expands at compile time to
special forms or to other macros, and the
expansion is then compiled as if it had been written. macroexpand at
the REPL shows the expansion of any of them.
Binding and assignment
Macro |
Does |
|---|---|
Store into a name, attribute, subscript, or ref, choosing the special by target shape |
|
Add to or subtract from a binding in place |
|
Delete a name, attribute, or subscript |
|
Read a name, attribute, or subscript and clear it |
|
Bind a name to a ref, typed by the target shape |
|
A ref to a name, attribute, subscript, or parameter |
|
Whether a location holds a value; store one unless it already does |
|
Sequential |
|
|
|
Local functions for a body, mutually recursive and not |
|
Declare a dynamic parameter |
|
Bind a name to an environment variable |
|
Name the module’s public features |
|
Mark the function a program runs once its module has loaded |
Conditionals
Macro |
Does |
|---|---|
Two-armed conditional over |
|
One-armed conditionals |
|
Conditional with a boolean default |
|
Truthiness as a boolean |
|
Identity test against the |
|
Membership |
|
Raise |
|
A no-op expression, and a bare control word |
Definitions
Macro |
Does |
|---|---|
Define a function and bind it in the current scope |
|
Prefix over |
|
Define a class and bind it in the current scope |
|
The superclass proxy inside a method |
|
What |
|
Python’s |
Iteration and collections
Macro |
Does |
|---|---|
A generator over a |
|
A list from the same shape |
|
A dict from |
|
A slice object; a slice of a sequence |
|
Nested item and attribute chains |
|
Positions in a pair chain |
|
Compose functions right to left |
Macros about macros
Macro |
Does |
|---|---|
A transformer bound at the module from top level, or for the rest of a body inside one |
|
The Scheme-layer spelling: a transformer bound at the module, with any of the rule and match kinds or a bare form; its template names are kept apart from the use site, see Hygiene |
|
Add arms to an existing transformer |
|
A transformer scoped to a body |
|
Run a body at expand time and splice its result |
|
Capture a form with its source position for hygiene |
|
The same without evaluating the argument; in a template, writes a form raw ( |
|
Define a fence handler for a triple-backtick literal |
|
Expand a form fully, or by one step |
|
The same without quoting the form |
|
Compile, evaluate, and reach the compiler from a program |
|
Set or read a module’s reader and compiler settings |
|
Documentation for a name |