let fold f a e = let (_, ml) = poly_of a in List.fold_left (fun acc m -> let (q, x) = mono_of m in f q x acc) e ml