user
Tasks in this category have to do with sorting collections of objects.

Write a function that orders two lists or arrays filled with numbers.
The function should accept two lists as arguments and return `true` if the first list should be ordered before the second, and `false` otherwise.

The order is determined by lexicographic order: Comparing the first element of each list.
If the first elements are equal, then the second elements should be compared, and so on, until one of the list has no more elements.
If the first list runs out of elements the result is `true`.
If the second list or both run out of elements the result is `false`.

Note: further clarification of lexicographical ordering is expounded on the talk page here and here.
assistant
(formerly Perl 6)
There is already a built-in comparison operator.

```
my @a = <1 2 4>;
my @b = <1 2 4>;
say @a," before ",@b," = ", @a before @b;

@a = <1 2 4>;
@b = <1 2>;
say @a," before ",@b," = ", @a before @b;

@a = <1 2>;
@b = <1 2 4>;
say @a," before ",@b," = ", @a before @b;

for 1..10 {
    my @a = flat (^100).roll((2..3).pick);
    my @b = flat @a.map: { Bool.pick ?? $_ !! (^100).roll((0..2).pick) }
    say @a," before ",@b," = ", @a before @b;
}

```

Output:

```
1 2 4 before 1 2 4 = False
1 2 4 before 1 2 = False
1 2 before 1 2 4 = True
63 52 before 0 52 = False
17 75 24 before 31 75 24 = True
43 32 before 43 32 = False
73 84 before 2 84 = False
73 92 before 40 24 46 = False
16 24 before 41 24 = True
9 12 22 before 9 12 32 67 = True
81 23 before 81 23 = False
55 53 1 before 55 62 83 = True
20 40 51 before 20 17 78 34 = False
```