Re-add list_to_polynomial
TODO: implement -
This commit is contained in:
parent
200eec49ef
commit
8c722af8e9
20
polimani.pl
20
polimani.pl
@ -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
|
||||
|
Reference in New Issue
Block a user