Fix code identation

This commit is contained in:
Diogo Cordeiro 2018-11-24 15:06:39 +00:00
parent e6d3ae979f
commit 3357cbaa7e
1 changed files with 25 additions and 27 deletions

View File

@ -112,13 +112,12 @@ polynomial_variable(X) :-
% Returns true if X is a power term, false otherwise.
%
power(P^N) :-
(
N #>= 1,
%% zcompare((<), -1, N),
polynomial_variable(P)
;
fail
).
(
N #>= 1,
polynomial_variable(P)
;
fail
).
power(X) :-
polynomial_variable(X).
%% Tests:
@ -149,20 +148,19 @@ power(X) :-
%
term(N) :-
(
% If N is non a free variable
nonvar(N),
% Assert it as a number
number(N)
);
(
% If N is a free variable
not(compound(N)),
var(N),
% Assert it must be between negative and positive infinity
% This uses the CLP(FD) library, which makes this reversible,
% whereas `number(N)` is always false, since it only succeeds
% if the argument is bound to a intger or float
N in inf..sup
% If N is non a free variable
nonvar(N),
% Assert it as a number
number(N)
;
% If N is a free variable
not(compound(N)),
var(N),
% Assert it must be between negative and positive infinity
% This uses the CLP(FD) library, which makes this reversible,
% whereas `number(N)` is always false, since it only succeeds
% if the argument is bound to a intger or float
N in inf..sup
).
term(X) :-
power(X).
@ -340,23 +338,23 @@ simplify_term(Term_In, Term_Out) :-
%% simplifying the job of `join_similar_parts_of_term`
sort(0, @=<, L, L2),
(
%% If there's a 0 in the list, then the whole term is 0
%% If there's a 0 in the list, then the whole term is 0
member(0, L2),
Term_Out = 0
;
%% Otherwise
(
%% If there's only one element, then the term was already simplified
%% This is done so that the `exclude` following doesn't remove all ones
%% If there's only one element, then the term was already simplified
%% This is done so that the `exclude` following doesn't remove all ones
length(L2, 1),
Term_Out = Term_In
;
%% Remove all remaining ones
%% Remove all remaining ones
exclude(==(1), L2, L3),
join_similar_parts_of_term(L3, L4),
%% Reverse the list, since the following call gives the result in the
%% reverse order otherwise
reverse(L4, L5),
%% reverse order otherwise
reverse(L4, L5),
term_to_list(Term_Out, L5)
)
),