user
Task

Sort   (the values of)   three variables   (**X**,   **Y**,   and   **Z**)   that contain any value   (numbers and/or literals).

If that isn't possible in your language, then just sort numbers   (and note if they can be floating point, integer, or other).

I.E.:   (for the three variables   **x**,   **y**,   and   **z**),   where:

```
                        x =  'lions, tigers, and'
                        y =  'bears, oh my!'
                        z =  '(from the "Wizard of OZ")'

```

After sorting, the three variables would hold:

```
                        x =  '(from the "Wizard of OZ")'
                        y =  'bears, oh my!'
                        z =  'lions, tigers, and'

```

For numeric value sorting, use:
I.E.:   (for the three variables   **x**,   **y**,   and   **z**),   where:

```
                        x =  77444
                        y =    -12
                        z =      0

```

After sorting, the three variables would hold:

```
                        x =    -12
                        y =      0
                        z =  77444

```

The variables should contain some form of a number, but specify if the algorithm
used can be for floating point or integers.   Note any limitations.

The values may or may not be unique.

The method used for sorting can be any algorithm;   the goal is to use the most idiomatic in the computer programming language used.

More than one algorithm could be shown if one isn't clearly the better choice.

One algorithm could be:

```
                        •  store the three variables   x, y, and z
                                 into an array (or a list)   A
                         
                        •  sort  (the three elements of)  the array   A
                         
                        •  extract the three elements from the array and place them in the
                                 variables x, y, and z   in order of extraction

```

Another algorithm   (only for numeric values):

```
       x= 77444 
       y=   -12 
       z=     0      
    low= x                                          
    mid= y                                          
   high= z 
      x= min(low,  mid,  high)            /*determine the lowest value of X,Y,Z. */    
      z= max(low,  mid,  high)            /*    "      "  highest  "    " " " "  */    
      y=     low + mid + high - x - z     /*    "      "  middle   "    " " " "  */      

```

Show the results of the sort here on this page using at least the values of those shown above.
assistant
(formerly Perl 6)

Raku 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 comparator. It is trivial to modify the sort comparator 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. )

```
# Sorting strings. Added a vertical bar between strings to make them discernable
my ($a, $b, $c) = 'lions, tigers, and', 'bears,  oh my!', '(from "The Wizard of Oz")';
say "sorting: {($a, $b, $c).join('|')}";
say ($a, $b, $c).sort.join('|'), ' - standard lexical string sort';

# Sorting numeric things
my ($x, $y, $z) = 7.7444e4, -12, 18/2;
say "\nsorting: $x $y $z";
say ($x, $y, $z).sort, ' - standard numeric sort, low to high';

# Or, with a modified comparitor:
for  -*,       ' - numeric sort high to low',
     ~*,       ' - lexical "string" sort',
     *.chars,  ' - sort by string length short to long',
     -*.chars, ' - or long to short'
  -> $comparitor, $type {
    my ($x, $y, $z) = 7.7444e4, -12, 18/2;
    say ($x, $y, $z).sort( &$comparitor ), $type;
}
say '';

# sort ALL THE THINGS
# sorts by lexical order with numeric values by magnitude.
.say for ($a, $b, $c, $x, $y, $z).sort;

```

Output:

```
sorting: lions, tigers, and|bears,  oh my!|(from "The Wizard of Oz")
(from "The Wizard of Oz")|bears,  oh my!|lions, tigers, and - standard lexical string sort

sorting: 77444 -12 9
(-12 9 77444) - standard numeric sort, low to high
(77444 9 -12) - numeric sort high to low
(-12 77444 9) - lexical "string" sort
(9 -12 77444) - sort by string length short to long
(77444 -12 9) - or long to short

(from "The Wizard of Oz")
-12
9
77444
bears,  oh my!
lions, tigers, and
```