Previous topic  Top  Next topic  Print this Topic
 

Ordering Query Results: outorder

 

If you want to specify the sequence of the output variables then you can use the "outorder" query option. For example, with the facts

Man::Person.

Woman::Person.

the output of the query

@{q1, options[outorder(?X,?Y)]} ?- ?X::?Y.

will be

Man,Person

Woman,Person

With

@{q1, options[outorder(?Y,?X)]} ?- ?X::?Y.

the output will be

Person,Man

Person,Woman

The "outorder" option can also be used for skipping some variable bindings in the result: With

@{q1, options[outorder(?X)]} ?- ?X::?Y.

the output will be

Man

Woman