Question: applyrule with conditional

test := proc(x) print("x=", x); op(0, x) = f end proc:
applyrule(conditional(x::anything, _test(x)) = 0, f(1));
                           "x=", f(1)
                            "x=", 0
                               0

test := proc(x) print("x=", x); op(0, x) = g end proc:
applyrule(conditional(x::anything, _test(x)) = 0, f(1));
                               0

First, I think this is wrong. Second, how to make applyrule forget the (apparently) cached result? Third, if it doesn't like me using the underscore with my own function, is there a way to rewrite conditional without it?

EDIT: As Carl pointed out here, gc() can be used as a kind of a universal forget() function. The second applyrule correctly returns f(1) after gc().

Please Wait...