Sort stability: Difference between revisions

added OpenEdge solution
(→‎{{header|PARI/GP}}: expand slightly)
(added OpenEdge solution)
Line 172:
=={{header|OCaml}}==
OCaml's [http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html#VALsort List.sort] and [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Array.html#VALsort Array.sort] functions are not guaranteed to be stable. The stable versions are [http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html#VALstable_sort List.stable_sort] and [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Array.html#VALstable_sort Array.stable_sort], respectively.
 
=={{header|OpenEdge/Progress}}==
The results are stable.
<lang progress>DEFINE TEMP-TABLE tt
FIELD country AS CHAR FORMAT 'x(2)'
FIELD city AS CHAR FORMAT 'x(16)'
.
 
CREATE tt. ASSIGN tt.country = 'UK' tt.city = 'London'.
CREATE tt. ASSIGN tt.country = 'US' tt.city = 'New York'.
CREATE tt. ASSIGN tt.country = 'US' tt.city = 'Birmingham'.
CREATE tt. ASSIGN tt.country = 'UK' tt.city = 'Birmingham'.
 
FOR EACH tt BY tt.country:
DISPLAY tt.country tt.city.
END.
 
FOR EACH tt BY tt.city:
DISPLAY tt.country tt.city.
END.</lang>
 
=={{header|Oz}}==
73

edits