let apply_subst (subst : ('a,'b) s) = iter_term (fun x -> try (List.assoc x subst) with _ -> (Var x)) (fun r l -> Operation(r,List.rev l)) (fun l x -> x::l) []