Jonathan Scott Duff wrote:
>
> Does the presence of an ordering subroutine cause perl to generate a
> linked list of all the elements of the %hash in the proper sequence
> prior to iteration (and somehow attach it to the iterator)? Seems
> like everytime we did that it would generate a new oper
On Fri, Aug 18, 2000 at 09:31:44AM +0100, Hildo Biersma wrote:
> Ah, syntax - I have no idea.
Well, syntax aside, how would this work?
> One thing we could do, theoretically:
>
> %hash = ('James' => 'Gibbon',
> 'Dave' => 'Mallon',
> 'Pete' => 'Munro');
>
> while (my ($key,
"David L. Nicol" wrote:
>
> Hildo Biersma wrote:
> >
> > > =head1 ABSTRACT
> > >
> > > Herein a new syntax is introduced to specify a sort function
> > > for the keys of any hash.
> > >
> > > =head1 DESCRIPTION
> > >
> > > %professors{ $a->name cmp $b->name };
> >
> > I feel the sort orde
> =head1 ABSTRACT
>
> Herein a new syntax is introduced to specify a sort function
> for the keys of any hash.
>
> =head1 DESCRIPTION
>
> %professors{ $a->name cmp $b->name };
I feel the sort order should be specified on the iterator, not on the
hash variable. It should be possible to
> >>%professors{ $a->name cmp $b->name };
> >>
> >>%students{ $$students{$b}{GPA} <=> $$students{$a}{GPA} };
> >
> > These already mean something. Please don't "special-case" them.
>
> No they don't.
Apologies. You're quite correct.
> > Isn't this b
Damian Conway wrote:
>
>>%professors{ $a->name cmp $b->name };
>>
>>%students{ $$students{$b}{GPA} <=> $$students{$a}{GPA} };
>
> These already mean something. Please don't "special-case" them.
No they don't.
[david@nicol1 perl]$ perl -le '%nums = (1..20); print %nums{1}'
C
In message <[EMAIL PROTECTED]>
Perl6 RFC Librarian <[EMAIL PROTECTED]> wrote:
> A "sort function" will need to be added into the list of magics
> maintained for every associative array.
>
> A set of macros in terms of sort will need to be defined which
> replace keys, values, and each f
>%professors{ $a->name cmp $b->name };
>
>%students{ $$students{$b}{GPA} <=> $$students{$a}{GPA} };
These already mean something. Please don't "special-case" them.
Isn't this better handled with a (revamped and faster) tie?
tie %professors, 'Tie::Sorted', ^a->name cmp