Whenever possible, I prefer to use expressions to compress IO
?- forall((flight(X,_,Y,_,N), N > 180), writeln((x=X,y=Y))).
for example with another generator
?- forall((member(X,"12"),member(Y,"ab")),writeln((x=X,y=Y))). x=49,y=97 x=49,y=98 x=50,y=97 x=50,y=98 true.
Of course, for the right indentation tables, format / 2 would be much better ...
change is possible, I misunderstood the question, assuming that you have already considered
query(X,Y) :- flight(X,_,Y,_,N), N > 180.
Capellic
source share