Did you know ... Search Documentation:
Pack xlibrary -- prolog/partsort.pl
PublicShow source
 partsort(:Pred, +List, -Sorted) is det
Partial sort. Used to sort a list when the order can be determined only for > and =, and not for all the elements. For instance, when ordering the branches of a tree in such a way that the parents appear first, two nodes of different branches are unrelated, but children are higher than their parents. Note that if used with the compare/3 predicate, it is equivalent to predsort/3 implemented with the selection sort algorithm.