Version: 5.1.1
7 Definitions
This library is
unstable;
compatibility will not be maintained.
See
Unstable for more information.
Provides macros for creating and manipulating definitions.
7.1 Deferred Evaluation in Modules
When used at the top level of a module, evaluates expr at the end of
the module. This can be useful for calling functions before their definitions.
Examples: |
| > (require 'Failure) | reference to an identifier before its definition: f in | module: 'Failure | | > (require 'Success) |
|
7.2 Conditional Binding
These are useful for writing programs that are portable across versions of
Racket with different bindings, to provide an implementation of a binding for
versions that do not have it but use the built-in one in versions that do.
7.3 Renaming Definitions
Establishes a rename transformer for each new identifier,
redirecting it to the corresponding old identifier.
7.4 Forward Declarations
Provides forward declarations of identifiers to be defined later. It
is useful for macros which expand to mutually recursive definitions, including
forward references, that may be used at the Racket top level.
7.5 Definition Shorthands
Defines the form
name as a shorthand for setting the parameter
parameter. Specifically,
(name value body ...) is equivalent
to
(parameterize ([parameter value]) body ...).
7.6 Macro Definitions
Defines a syntax transformer for each
macro-id based on the local
definition of each
expander-id
(defaulting to
macro-id/proc) in
body ....
Especially useful for mutually recursive expander functions and phase 1 macro
definitions. Subsumes the behavior of
define-syntax-set.
Examples: |
| > (implies #t (printf "True!\n")) | True! | > (implies #f (printf "False!\n")) | #t | > (nand #t #t (printf "All True!\n")) | All True! | #f | > (nand #t #f (printf "Some False!\n")) | #t | | eval:8:0: undefined-macro/proc: transformer must be defined | within define-syntax-block in: undefined-macro/proc |
|
7.7 Effectful Transformation
Executes e during phase 1 (the syntax transformation phase)
relative to its context, during pass 1 if it occurs in a head expansion
position.
Executes e during phase 1 (the syntax transformation phase)
relative to its context, during pass 2 (after head expansion).