chickadee » begin-syntax

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

begin-syntax

Description

This is a small extension that allows for inline macro operations.

The source for this extension is available here.

Usage

(begin-syntax EXPR ...)syntax

Evaluates its body and immediately inserts the final result into the program, as though by macro expansion.

If the result is a macro transformer, then this is immediately invoked with no arguments and the result is inserted into the program. Note that in this case the final expression of the begin-syntax body will be evaluated twice.

This form can be thought of as a macro definition followed by its immediate expansion, for example:

(begin-syntax '(+ 1 2))

; => (let-syntax ((a (er-macro-transformer
;                     (lambda (_ _ _) '(+ 1 2)))))
;      (a))

Author

Evan Hanson

License

3-Clause BSD

Contents »