Artifact Content
Not logged in

Artifact a9061a338889d74caa747b94859b38768ae362a8


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()