Heronian triangles: Difference between revisions
→{{header|Logtalk}}: Refactored the ordering code.
Ttmrichter (talk | contribs) (→{{header|Logtalk}}: Used aliases to clean up some of the clutter in reading the test object.) |
Ttmrichter (talk | contribs) (→{{header|Logtalk}}: Refactored the ordering code.) |
||
Line 3,092:
).
▲ order_by_area(=, T, T) :- !.
order_by(_, <, t(_,_,C1,_,_), t(_,_,C2,_,_)) :- C1 < C2, !.
▲ order_by_perimeter(>, t(_,_,_,_,Perimeter1), t(_,_,_,_,Perimeter2)) :- Perimeter1 > Perimeter2, !.
▲ order_by_sides(<, t(A1,_,_,_,_), t(A2,_,_,_,_)) :- A1 < A2, !.
▲ order_by_sides(<, t(_,B1,_,_,_), t(_,B2,_,_,_)) :- B1 < B2, !.
▲ order_by_sides(<, t(_,_,C1,_,_), t(_,_,C2,_,_)) :- C1 < C2, !.
▲ order_by_sides(>, _, _).
:- end_object.
</syntaxhighlight>
|