From 3357cbaa7e1aa2a5c94a4fdea6b823dd2f35ecf2 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Sat, 24 Nov 2018 15:06:39 +0000 Subject: [PATCH] Fix code identation --- polymani.pl | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/polymani.pl b/polymani.pl index 79ff77a..ab93cf6 100644 --- a/polymani.pl +++ b/polymani.pl @@ -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) ) ),