On Wed, Aug 23, 2006 at 03:19:22PM -0700, Larry Wall wrote:
: But I'd still probably use a hyper-fatarrow for this case rather than
: relying on interleaving.
Another reason for preferring hyper is that it makes promises about
parallelizability, whereas the zip/each solutions would tend to
assume
> Reduce operators only turn infix into list operators. What you really
> want here is a hyper-fatarrow:
>
> my %h = @k »=>« @v;
Ah, right. Silly me. I got hyper and reduce confused. Thanks!
Gaal pointed out using zip. What would be the difference then between a
hyper-fatarrow an
On Thu, Aug 24, 2006 at 12:51:04AM +0300, Gaal Yahas wrote:
: On Wed, Aug 23, 2006 at 05:43:48PM -0400, Mark J. Reed wrote:
: > But is there an easy way in Perl6 to do it all in one go? Should this work?
: >
: > my %h = @k [=>] @v;
:
: You want a zip:
:
: my %h = @k ¥ @v;
: my %h = @k Y @v;
: my %h;
: [EMAIL PROTECTED] = @v;
:
: But is there an easy way in Perl6 to do it all in one go? Should this
work?
:
: my %h = @k [=>] @v;
Reduce operators only turn infix into list operators. What you really
want here is a hyper-fatarrow:
my %h = @k »=>« @v;
Gaal pointed out using zip
Mark J. Reed skribis 2006-08-23 17:43 (-0400):
> But is there an easy way in Perl6 to do it all in one go? Should this work?
> my %h = @k [=>] @v;
Hyper is not [], but >><<. And >>=><< works perfectly in Pugs, and does
exactly what you describe.
[] is for reduction, and is prefix: [+] 1,2,3
Ju
On Wed, Aug 23, 2006 at 05:43:48PM -0400, Mark J. Reed wrote:
: Suppose I have two arrays @k and @v and I want to declare and initialize a
: hash %h such that %h.keys eqv @k and %h.values eqv @v.
:
: I could use a direct translation of the P5 idiom:
:
: my %h;
: [EMAIL PROTECTED] = @v;
:
: But i
On Wed, Aug 23, 2006 at 05:43:48PM -0400, Mark J. Reed wrote:
> But is there an easy way in Perl6 to do it all in one go? Should this work?
>
> my %h = @k [=>] @v;
You want a zip:
my %h = @k ¥ @v;
my %h = @k Y @v; # ASCII fallback
my %h = zip(@k, @v); # or maybe zip(@k; @v) this week?
--
Suppose I have two arrays @k and @v and I want to declare and initialize a
hash %h such that %h.keys eqv @k and %h.values eqv @v.
I could use a direct translation of the P5 idiom:
my %h;
[EMAIL PROTECTED] = @v;
But is there an easy way in Perl6 to do it all in one go? Should this work?
my %h