
# Test functionality that enables user-defined procedures to be applied
# to an expression until it no longer changes (the user-defined analogue
# of the 'repeat=True' option).


def fixed(fun, obj):
    while fun(obj).state()==result_t.changed:
        print "ran"
    return obj

def runit(ex):
    join_gamma(ex)
    distribute(ex, keepstate=True)
    sort_product(ex, keepstate=True)
    print(ex)
    return ex

def test02():
    \delta_{m n}::KroneckerDelta.
    \Gamma_{#}::GammaMatrix(metric=\delta).
    obj3a:= \Gamma_{c d}\Gamma_{m1 m2 m3}\Gamma_{n1 n2};
    return fixed(runit, obj3a)
