Stories
Slash Boxes
Comments
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Maybe this doesn't make sense but some way to stick with method calls appeals to me.

    Instead of:


    @dogs.sort: { .name }

    Something like:


    @dogs.sort_by.name

    But even as already implemented, I agree it's an improvement and a nice language feature. Thanks, Patrick!

    • 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,

      @list.sort.reverse
      @list.sort.map { ... }

      Also, something like @list.sort_by.name gets the invocant in the wrong place, because in order for this to work the invocants to .name should be the individual elements of @list.

      So, I think the information on how to sort (e.g., .name) really deserves to