Artifact 157799e01f30b7fa349a8a515d2151b54b7643c1
- 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]
def reverse(lst, acc) { case(lst) when( {car:a, cdr: d} ) { reverse(d, {car:a, cdr:acc}) } when( {} ) { acc } }; @macro reverseArgs(e) {@value( var ev = @macro(e); case(ev) when( {is:"App", fun:f, args:a} ) { ev {args: reverse(a, {})} } when( _ ) { ev } )}; def main() { print( reverseArgs(1 + 2) ); print( reverseArgs(1 - 2) ); }; main()