NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
schwartzian transforms now a builtin (Score:1)
in the first version we compute .lc on each element only once for the entire sort, whereas in the second version it's computed once for each comparison.
Nice.
or this? (Score:1)
Maybe this doesn't make sense but some way to stick with method calls appeals to me.
Instead of:
@dogs.sort: {
Something like:
@dogs.sort_by.name
But even as already implemented, I agree it's an improvement and a nice language feature. Thanks, Patrick!
Re: (Score:1)
Part of the difference here is that .sort_by (or .sort) is a method call on the list as a whole, and any method call after that really ought to be treated as a method call on the resulting sorted list. For example,
Also, something like .name should be the individual elements of @list.
@list.sort_by.namegets the invocant in the wrong place, because in order for this to work the invocants toSo, I think the information on how to sort (e.g.,
.name) really deserves toNice! (Score:1)
Aha! It's already in the spec! (Score:1)
Turns out that this particular form of
sortalready exists in the Perl 6 spec -- it was just in an odd place. In Synopis 3, we have:So, it's just Synopsis 29 that needs to be updated, and as of this morning Moritz++ has
A few problems... (Score:1)
Re: (Score:1)