[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Complex sort(?)



At 10:01 PM -0400 9/3/99, Ronald J Kimball wrote:
>On Fri, Sep 03, 1999 at 03:46:54PM -0700, Bruce Van Allen wrote:
>> The next question is, who tells Tom C.?  :-)
>
>It's already been fixed.  The current devel release, 5.005_61 has the
>correct code.

Cool. Still seems like the www.perl.com site's version of the faq 
(your original link) could be corrected. However, my message (below) 
to perlfaq-suggestions@perl.com just got bounced back, 'Service 
unavailable'; I'll try once more and then that's that. I don't visit 
that site much, so I'm not familiar with their attentiveness to 
corrections...

Meanwhile, I'm about to plunge into a few long but I expect enjoyable 
days of a large project in Perl linking twenty public and university 
library systems in my region. A cross-platform challenge (write on 
Mac, test on UNIX, finally host on NT) in which the eol issues are 
trivial relative to others...

I pace myself on projects like this by baking sourdough bread, but 
(fair warning!) I also hope to bake a pi that I promised to Brian a 
couple weeks ago...

1;

__END__

Sent to perlfaq-suggestions@perl.com:

Some of us on the MacPerl list spotted an error in the section 
#How_do_I_sort_an_array_by_anyth of perlfaq4 as posted at

<http://www.perl.com/pub/doc/manual/html/pod/perlfaq4.html#How_do_I_so 
rt_an_array_by_anyth>

EXCERPT_FROM_FAQ>>;

Which could also be written this way, using a trick that's come to be 
known as the Schwartzian Transform:

     @sorted = map  { $_->[0] }
               sort { $a->[1] cmp $b->[1] }
               map  { [ $_, uc((/\d+\s*(\S+)/ )[0] ] } @data;

EXCERPT_FROM_FAQ

The last excerpted line above is missing a right parenthesis. 
Shouldn't it read as follows?

               map  { [ $_, uc((/\d+\s*(\S+)/ )[0]) ] } @data;
                                                  ^

Thanks.


- Bruce

__Bruce_Van_Allen___bva@cruzio.com__831_429_1688_V__
__PO_Box_839__Santa_Cruz_CA__95061__831_426_2474_W__


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org