static Exp nlLogic_transformShallow(Exp e, F1 f) { if (e == null) null; if (e cast And) ret And(nlLogic_transformShallow(e.a, f), nlLogic_transformShallow(e.b, f)); if (e cast ExpNot) ret ExpNot(nlLogic_transformShallow(e.a, f)); ret callF(f, e); } static IfThen nlLogic_transformShallow(IfThen rule, F1 f) { if (rule == null) null; rule = (IfThen) shallowClone(rule); rule.in = nlLogic_transformShallow(rule.in, f); rule.out = nlLogic_transformShallow(rule.out, f); ret rule; }