Sort three variables: Difference between revisions

m
Fix Perl 6 -> Raku in comments, typos
(Add Swift)
m (Fix Perl 6 -> Raku in comments, typos)
Line 1,997:
=={{header|Raku}}==
(formerly Perl 6)
 
Perl 6Raku has a built in sort routine which uses a variation of quicksort. The built in sort routine will automatically select a numeric sort if given a list of Real numeric items and a lexical Unicode sort if given a list that contains strings. The default numeric sort won't sort complex numbers unless you give it a custom comparitorcomparator. It is trivial to modify the sort comparitorcomparator function to get whatever ordering you want though.
 
The list (77444, -12, 0) is a poor choice to demonstrate numeric sort since it will sort the same numerically or lexically. Instead we'll use (7.7444e4, -12, 18/2). ( A Num, an Int, and a Rat. )
10,333

edits