develooper Front page | perl.perl6.language | Postings from August 2006

Re: Pair of lists => list of pairs?

Thread Previous | Thread Next
From:
Gaal Yahas
Date:
August 23, 2006 14:52
Subject:
Re: Pair of lists => list of pairs?
Message ID:
20060823215104.GA27085@sike.forum2.org
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?

-- 
Gaal Yahas <gaal@forum2.org>
http://gaal.livejournal.com/

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