Re-add list_to_polynomial

TODO: implement -
This commit is contained in:
Diogo Cordeiro 2018-11-22 20:00:44 +00:00
parent 200eec49ef
commit 8c722af8e9
2 changed files with 20 additions and 0 deletions

View File

@ -432,6 +432,26 @@ polynomial_to_list(T, [T]) :-
%@ % Execution Aborted
%@ P = -2.3+x+x^2 .
%% list_to_polynomial(+P:polynomial, -L:List)
%
% Converts a list in a polynomial.
% TODO: not everything is a +, there are -
%
list_to_polynomial([T1|T2], P) :-
list_to_polynomial(T2, L1),
(
not(L1 = []),
P = L1+T1
;
P = T1
),
% The others computations are semantically meaningless
!.
list_to_polynomial(T, P) :-
P = T.
%% Tests:
%% TODO
%% negate_term(T, T2) is det
%
% Negate the coeficient of a term and return the negated term

0
teste.pl Normal file
View File