in reply to Re: my array is almost a hash, but keys are not unique. (Perl 6)
in thread my array is almost a hash, but keys are not unique.

That's excellent, thanks Moritz!

I'd seen something recently about how for can work on pairs, but seeing it used to solve a problem I'm working on makes it much clearer.

The final classify example has me really puzzled. I can't see the array creation, nor see what the test does.

In my current program, the $in arrayref is defined by doing a file, so I suppose I would have the option in perl 6 of doing that file as perl6, and getting pairs.

BTW, what do you mean by "diplomatic perl 6" ? Is that something like "perl 6, no matter who you ask", because different people have different ideas what's going to be in it?


- Boldra
  • Comment on Re^2: my array is almost a hash, but keys are not unique. (Perl 6)

Replies are listed 'Best First'.
Re^3: my array is almost a hash, but keys are not unique. (Perl 6)
by moritz (Cardinal) on Apr 03, 2009 at 09:25 UTC
    The final classify example has me really puzzled. I can't see the array creation, nor see what the test does.

    I omitted the array creation, because it's the same as above (array of pairs)

    The test does basically nothing, it just returns the Pair unchanged. Since it is supposed to return a Pair anyway, it nicely fits into what .classify attempts.

    BTW, what do you mean by "diplomatic perl 6"

    I meant to write 'idiomatic', made a typo, and picked the wrong suggestion from my spell checker :-)