Hi
The documention of sort/4 sort/4
says:
The following example sorts a list of rows, for example resulting from csv_read_file/2) ascending on the 3th column and descending on the 4th column:
sort(4, @>=, Rows0, Rows1), sort(3, @=<, Rows1, Sorted).
But that is wrong isn’t it? The first sort will sort on column 4 then the second sort will sort on column 3 i.e. only the second sort will have any effect.
The following illustrates:
test :-
X1 = [row(3, a), row(1, b), row(2, c), row(1, c), row(1, a)],
sort(1, @=<, X1, X2),
sort(2, @=<, X2, X3),
write(X3).
:- test.
[row(1,a),row(3,a),row(1,b),row(1,c),row(2,c)]
true.