develooper Front page | perl.perl6.language.objects | Postings from August 2000

Re: RFC 124 (v1) Sort order for any hash

From:
David L. Nicol
Date:
August 18, 2000 13:31
Subject:
Re: RFC 124 (v1) Sort order for any hash
Message ID:
399D9CE8.3970F0AD@kasey.umkc.edu




And not only is it less to write, as a programmer, but you can
abstract a general "sort these records by GPA" routine and
everything can use the same one, fewer memory pages to dirty.




Damian Conway wrote:
> 
>    > > my %students : sorted( $ME{^1}{GPA} <=> $ME{^0}{GPA} );
>    > >
>    > Yes, I was thinking the same thing. Except the '$ME' thing--what's that? (I
>    > must have missed that discussion...)
> 
> It's an idea that within a method call, the object reference would
> not be passed as the first argument (or maybe, not *just* as the
> first argument), but in a variable named $ME. I was pushing that
> envelope a little.
> 
>    > What's wrong with @_?
> 
> We're trying to sort like this:
> 
>         sort  $student{^1}{GPA} <=> $student{^0}{GPA} ),  keys %student;
> 
> Within the %student's internals, %student is %ME :-)
> 
> Damian

-- 
                          David Nicol 816.235.1187 nicold@umkc.edu
                      Does despair.com sell a discordian calendar?



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About