Differences From Artifact [94485181e809cc7b]:
- File
sample/ast.pmy
- 2010-11-23 10:37:54 - part of checkin [5e924caac9] on branch trunk - added AST-rewriting macro sample. (user: kinaba) [annotate]
To Artifact [157799e01f30b7fa]:
- File
sample/ast.pmy
- 2010-11-24 11:20:42 - part of checkin [153a14cec0] on branch trunk - if-then-else without {}s. some cosmetic changes (user: kinaba) [annotate]
4 when( {car:a, cdr: d} ) { reverse(d, {car:a, cdr:acc}) } 4 when( {car:a, cdr: d} ) { reverse(d, {car:a, cdr:acc}) }
5 when( {} ) { acc } 5 when( {} ) { acc }
6 }; 6 };
7 7
8 @macro reverseArgs(e) {@value( 8 @macro reverseArgs(e) {@value(
9 var ev = @macro(e); 9 var ev = @macro(e);
10 case(ev) 10 case(ev)
11 when( {is:"app", fun:f, args:a} ) | 11 when( {is:"App", fun:f, args:a} )
12 { 12 {
13 ev {args: reverse(a, {})} 13 ev {args: reverse(a, {})}
14 } 14 }
15 when( _ ) 15 when( _ )
16 { 16 {
17 ev 17 ev
18 } 18 }