diff --git a/polimani.pl b/polimani.pl index 24b7506..06e7e9f 100644 --- a/polimani.pl +++ b/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 diff --git a/teste.pl b/teste.pl new file mode 100644 index 0000000..e69de29