[ library(gfd) | Reference Manual | Alphabetic Index ]

# <ConsistencyModule:> sorted_g(?Unsorted, ?Sorted, ?Positions)

Sorted is a sorted permutation (described by Positions) of Unsorted, with native Gecode indexing.

Unsorted
  Collection of N (domain) variables or integers
Sorted
  Collection of N (domain) variables or integers
Positions
  Collection of N (domain) variables or integers

## Description

This version of sorted/3 uses the native Gecode indexing, which starts from 0, i.e. the first element of the collections has index 0. This is different from normal ECLiPSe's indexing, which starts from 1.

This predicate maps more directly to Gecode's native implementation of the constraint, without the conversion between Gecode and ECLiPSe indexing of sorted/3. It may therefore be more efficient, but could also be incompatible with existing ECLiPSe code.

See sorted/3 for a more detailed description of this predicate.

### Modes and Determinism

- sorted_g(+, ?, ?)
- sorted_g(?, +, ?)
- sorted_g(?, ?, +)

## See Also

sorted / 3