Heronian triangles: Difference between revisions

Content added Content deleted
(→‎{{header|Logtalk}}: Rewrote the test code to be more comprehensible, adding comments where needed. Changed representation from a tuple to a fact for performance reasons.)
(→‎{{header|Logtalk}}: Modified test code to eliminate an unnecessary helper predicate by using a lambda expression.)
Line 3,053:
display_each_element(Perimeter10),
 
% use a lambda expression to reduce the noise of silly little helper predicates
bagof(Element, with_area{Element, Primitives}/(list::member(Element, Primitives), Element = t(_,_,_,210.0,_)), Area210),
print(@'The list of those with an area of 210 is:\n'),
display_each_element(Area210).
 
% localized helper predicates
 
with_area(E, P, N) :-
list::member(E, P),
E = t(_,_,_,N,_).
 
% display a single element in the provided format