Implement professor's simpoly_list and remove previous one

This commit is contained in:
Diogo Cordeiro 2018-11-22 18:12:03 +00:00
parent d217a20c70
commit 0a65fd0a7f

View File

@ -411,19 +411,14 @@ transform_list(Pred, [L | LS], [R | RS]) :-
%% ?- transform_list(term_to_list, L, [[x^1], [x^1], [2]]). %% ?- transform_list(term_to_list, L, [[x^1], [x^1], [2]]).
%@ L = [x, x, 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_list(L, S) :-
simplify_polynomial(L1, L2), polynomial_to_list(P1, L),
L3 = [L2]. simplify_polynomial(P1, P2),
simplify_polynomial_list([L1|L2],L3) :- polynomial_to_list(P2, S).
simplify_polynomial(L1, P1),
simplify_polynomial_list(L2, P2),
L3 = [P1|P2],
% There is nothing further to compute at this point
!.
%% polynomial_to_list(+P:polynomial, -L:List) %% polynomial_to_list(+P:polynomial, -L:List)
% %