source: project/wiki/eggref/4/begin-syntax @ 33617

Last change on this file since 33617 was 33617, checked in by evhan, 3 years ago

wiki/w-c-d: Add documentation

File size: 977 bytes
Line 
1[[tags: egg]]
2
3== begin-syntax
4
5[[toc:]]
6
7== Description
8
9This is a small extension that allows for inline macro operations.
10
11The source for this extension is available [[http://git.foldling.org/chicken-begin-syntax.git|here]].
12
13== Usage
14
15<syntax>(begin-syntax EXPR ...)</syntax>
16
17Evaluates its body and immediately inserts the final result into the
18program, as though by macro expansion.
19
20If the result is a macro transformer, then this is immediately invoked
21with no arguments and the result is inserted into the program. '''Note
22that in this case the final expression of the {{begin-syntax}} body will
23be evaluated twice'''.
24
25This form can be thought of as a macro definition followed by its
26immediate expansion, for example:
27
28<enscript>
29(begin-syntax '(+ 1 2))
30
31; => (let-syntax ((a (er-macro-transformer
32;                     (lambda (_ _ _) '(+ 1 2)))))
33;      (a))
34</enscript>
35
36== Author
37
38[[/users/evan-hanson|Evan Hanson]]
39
40== License
41
42Copyright (c) 2016, 3-Clause BSD
Note: See TracBrowser for help on using the repository browser.