diff --git a/polimani.pl b/polimani.pl index 2f21b4a..f71796f 100644 --- a/polimani.pl +++ b/polimani.pl @@ -411,19 +411,14 @@ transform_list(Pred, [L | LS], [R | RS]) :- %% ?- transform_list(term_to_list, L, [[x^1], [x^1], [2]]). %@ L = [x, x, 2]. -%% simplify_polynomial_list(+L1,-L3) is det +%% simplify_polynomial_list(+L:list, -S:list) is det % -% Simplifies a list of polynomials +% Simplifies a polynomial represented as a list % -simplify_polynomial_list([L1], L3) :- - simplify_polynomial(L1, L2), - L3 = [L2]. -simplify_polynomial_list([L1|L2],L3) :- - simplify_polynomial(L1, P1), - simplify_polynomial_list(L2, P2), - L3 = [P1|P2], - % There is nothing further to compute at this point - !. +simplify_polynomial_list(L, S) :- + polynomial_to_list(P1, L), + simplify_polynomial(P1, P2), + polynomial_to_list(P2, S). %% polynomial_to_list(+P:polynomial, -L:List) %