5e924caac9 2010-11-23 kinaba: def reverse(lst, acc) 5e924caac9 2010-11-23 kinaba: { 5e924caac9 2010-11-23 kinaba: case(lst) adacc96a55 2010-11-24 kinaba: when {car:a, cdr: d}: reverse(d, {car:a, cdr:acc}) adacc96a55 2010-11-24 kinaba: when {}: acc 5e924caac9 2010-11-23 kinaba: }; 5e924caac9 2010-11-23 kinaba: 5e924caac9 2010-11-23 kinaba: @macro reverseArgs(e) {@value( 5e924caac9 2010-11-23 kinaba: var ev = @macro(e); 5e924caac9 2010-11-23 kinaba: case(ev) adacc96a55 2010-11-24 kinaba: when {is:"App", fun:f, args:a}: adacc96a55 2010-11-24 kinaba: ( 5e924caac9 2010-11-23 kinaba: ev {args: reverse(a, {})} adacc96a55 2010-11-24 kinaba: ) adacc96a55 2010-11-24 kinaba: when _ : adacc96a55 2010-11-24 kinaba: ( 5e924caac9 2010-11-23 kinaba: ev adacc96a55 2010-11-24 kinaba: ) 5e924caac9 2010-11-23 kinaba: )}; 5e924caac9 2010-11-23 kinaba: 5e924caac9 2010-11-23 kinaba: def main() 5e924caac9 2010-11-23 kinaba: { 5e924caac9 2010-11-23 kinaba: print( reverseArgs(1 + 2) ); 5e924caac9 2010-11-23 kinaba: print( reverseArgs(1 - 2) ); 5e924caac9 2010-11-23 kinaba: }; 5e924caac9 2010-11-23 kinaba: 5e924caac9 2010-11-23 kinaba: main()