Schwartzian method
- From: jis <jismagic@xxxxxxxxx>
- Date: Tue, 12 Jun 2007 16:30:40 -0000
Hi all,
I was reading through UR coloumn by Randal in ww.stonehenge.com. I
cam across the Schwartzian method which I find extremely difficult to
understand even after the explanation given by him.Please help me
understand the concepts.
1)
@data = <>; # read data
foreach (@data) {
($name,$score) = split; # get score
$score{$_} = $score; # record it
}
I guess $_ has the instantaneous data from @data. Am I correct?
2)
@pairs = map {
($name, $score) = split;
[ $_, $score ];
} @data;
What is $_ in the ablove code?
Randal says "I build a two-element anonymous list from the
$score and the original value $_". Can somebody help me to understand
what he means?
3)
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [$_, (split)[1] ] }
<>;
What is $_->[0] all about?
regards,
jis
.
- Follow-Ups:
- Re: Schwartzian method
- From: Paul Lalli
- Re: Schwartzian method
- Prev by Date: help on Schwartzian method
- Next by Date: Re: Schwartzian method
- Previous by thread: help on Schwartzian method
- Next by thread: Re: Schwartzian method
- Index(es):
Relevant Pages
|