(VAR f_1 x f_2 y g_1 f_3 g_2 z t l) (RULES app(app(apply, f_1), x) -> app(f_1, x) app(id, x) -> x app(app(app(uncurry, f_2), x), y) -> app(app(f_2, x), y) app(app(app(swap, f_2), y), x) -> app(app(f_2, x), y) app(app(app(compose, g_1), f_1), x) -> app(g_1, app(f_1, x)) app(app(const, x), y) -> x app(listify, x) -> app(app(cons, x), nil) app(app(app(app(fold, f_3), g_2), x), nil) -> x app(app(app(app(fold, f_3), g_2), x), app(app(cons, z), t)) -> app(app(f_3, app(g_2, z)), app(app(app(app(fold, f_3), g_2), x), t)) app(sum, l) -> app(app(app(app(fold, add), id), 0), l) app(app(uncurry, app(app(fold, cons), id)), nil) -> id append -> app(app(compose, app(app(swap, fold), cons)), id) reverse -> app(app(uncurry, app(app(fold, app(swap, append)), listify)), nil) length -> app(app(uncurry, app(app(fold, add), app(cons, 1))), 0) )