Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6book, 2011-10-19

| Channels | #perl6book index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
15:31 smash joined #perl6book
18:04 Doctor_Pi joined #perl6book
18:21 Entonian joined #perl6book
18:26 Entonian my @sorted = @names.sort( { %sets{$_} }).sort({ %matches{$_} }).reverse;
18:26 Entonian Shouldn't there be a reverse on the sort by sets, too?
18:49 Util Entonian: With the code as written, the output is:
18:49 Util Ana has won 2 matches and 8 sets
18:49 Util Dave has won 2 matches and 6 sets
18:49 Util Charlie has won 1 matches and 4 sets
18:49 Util Beth has won 1 matches and 4 sets
18:49 Util Changing the code to @names.sort( { %sets{$_} }).reverse.sort({ %matches{$_} }).reverse , we get:
18:49 Util Dave has won 2 matches and 6 sets
18:49 Util Ana has won 2 matches and 8 sets
18:49 Util Beth has won 1 matches and 4 sets
18:49 Util Charlie has won 1 matches and 4 sets
18:50 Util So, No, there should not be an extra reverse.
18:50 Util The .reverse method does not instruct .sort to sort in descending order, it just takes the list it is given and reverses the list order.
18:50 Util After the two sorts, the list is ordered by ascending-primary-key and ascending-secondary-key.
18:50 Util Reversing at that point makes the list is ordered by descending-primary-key and descending-secondary-key.
18:50 Entonian Util: Thank you
18:50 Util Glad to help!

| Channels | #perl6book index | Today | | Search | Google Search | Plain-Text | summary