5e924caac9 2010-11-23 kinaba: def reverse(lst, acc) 5e924caac9 2010-11-23 kinaba: { 5e924caac9 2010-11-23 kinaba: case(lst) 5e924caac9 2010-11-23 kinaba: when( {car:a, cdr: d} ) { reverse(d, {car:a, cdr:acc}) } 5e924caac9 2010-11-23 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) 153a14cec0 2010-11-24 kinaba: when( {is:"App", fun:f, args:a} ) 5e924caac9 2010-11-23 kinaba: { 5e924caac9 2010-11-23 kinaba: ev {args: reverse(a, {})} 5e924caac9 2010-11-23 kinaba: } 5e924caac9 2010-11-23 kinaba: when( _ ) 5e924caac9 2010-11-23 kinaba: { 5e924caac9 2010-11-23 kinaba: ev 5e924caac9 2010-11-23 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()