Commit 978c766d authored by Marius Frinken's avatar Marius Frinken

improved tips.pl

parent 644cf7a3
......@@ -20,8 +20,20 @@ tag_and_process(List):-
%Prolog offers multiple ways of sorting, this is one
% will delete duplicates
% comp_triples(Delta, (C1,_,_),(C2,_,_)):-
% compare(Delta,C1,C2).
%more complicated version that allows for equal values and does not offer faulty backtracking
comp_triples(Delta, (C1,_,_),(C2,_,_)):-
compare(Delta,C1,C2).
(
C1==C2 -> %if C1 has the same value as C2 , == does not unify
Delta = >;
compare(Delta,C1,C2)
).
% line 31 is a "dirty" hack, if C1 equals C2 we still answer > "greater"
% else, we use the built-in compare in line 32
my_sort(ListOfTriples, SortedListOfTriples):-
predsort(comp_triples,ListOfTriples,SortedListOfTriples).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment