develooper Front page | perl.perl6.users | Postings from May 2006

Re: Simple Print/Say Question

Thread Previous | Thread Next
From:
A. Pagaltzis
Date:
May 24, 2006 13:30
Subject:
Re: Simple Print/Say Question
Message ID:
20060524202957.GG32180@klangraum
* Ovid <publiustemp-perl6users@yahoo.com> [2006-05-24 18:00]:
> First off, thanks to Aristotle for clearing some of my
> thinking.

NP, it’s a good way for me to pick up the disparate Perl 6 clues
I picked up haphazardly over time, too.

> In my version of Pugs (6.2.11 (r10390)), that fails for two
> reasons, both of which I suspect are bugs.

These definitely sound like bugs – both of them.

>    for %buckets<w><array>.kv -> $i, $w {
> 
> Is .kv supposed to work there?  You're accessing an array, not
> a hash.

Yes, `.kv` is supposed to work on arrays, where it returns a list
of `$index => $value` pairs. This is very high on the list of
Perl 6 features I am anticipating eagerly, as it means you can
use natural `for(LIST)` constructs even when you need indices
while iterating, instead of having to use the familiar ugly
construction from Perl 5:

    for my $i ( 0 .. $#array ) {
        # use both $i and $array[ $i ] here
    }

In Perl 6, indexing into `@array` explicitly will *not* be
necessary here. Hooray!

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;

Thread Previous | Thread Next


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