Fixed. That was fast
This commit is contained in:
parent
2c98f9471f
commit
8318b40fc5
31
polimani.pl
31
polimani.pl
@ -10,7 +10,10 @@ polynomial_variable_p(P) :-
|
||||
polynomial_variables(V),
|
||||
member(X, V),
|
||||
%% number(N),
|
||||
P is X^N.
|
||||
P = X^N.
|
||||
|
||||
%% ?- term_to_list(X, [x^4]).
|
||||
%@ X = x^4 .
|
||||
|
||||
power_p(X) :-
|
||||
polynomial_variable_p(X).
|
||||
@ -18,7 +21,8 @@ power_p(X^N) :-
|
||||
polynomial_variable_p(X), integer(N), N >= 1.
|
||||
|
||||
%% ?- power_p(x^1).
|
||||
%@ true..
|
||||
%@ true .
|
||||
%@ true.
|
||||
|
||||
term_p(N) :-
|
||||
number(N).
|
||||
@ -110,30 +114,13 @@ term_to_list(P, [P2]) :-
|
||||
|
||||
%% ?- term_to_list(2*y*z*23*x*y*x^3*x, X).
|
||||
%@ X = [x^1, x^3, y^1, x^1, 23, z^1, y^1, 2] .
|
||||
%@ X = [x^1, x^3, y^1, x^1, 23, z^1, y^1, 2]
|
||||
%@ X = [x^1, x^3, y^1, x^1, 23, z^1, y^1, 2] .
|
||||
%@ X = [x, x^3, y, x, 23, z, y, 2] .
|
||||
%@ X = [x, x^3, y, x, 23, z, y, 2] .
|
||||
%@ X = [x^1, x^3, y^1, x^1, 23, z^1, y^1, 2] .
|
||||
%@ X = [x^1, x^3, y^1, x^1, 23, z^1, y^1, 2].
|
||||
%@ X = [x^1, x^3, y^1, x^1, 23, z^1, y^1, 2].
|
||||
%% ?- term_to_list(X, [y^1, x^1]).
|
||||
%@ X = x*y .
|
||||
%@ X = x*y .
|
||||
%@ X = x*y .
|
||||
%@ X = x*y .
|
||||
%@ X = x*y .
|
||||
%@ X = x*y .
|
||||
%@ X = x*y .
|
||||
%@ false.
|
||||
%% ?- term_to_list(X, [x^4]).
|
||||
%@ X = x^4 .
|
||||
%@ false.
|
||||
%@ false.
|
||||
%@ false.
|
||||
%@ false.
|
||||
%@ false.
|
||||
|
||||
%@ false.
|
||||
%% ?- term_to_list(X, [y^6, z^2, x^4]).
|
||||
%@ X = x^4*z^2*y^6 .
|
||||
|
||||
%% list_to_term([], 1).
|
||||
list_to_term([N], N) :-
|
||||
|
Reference in New Issue
Block a user