Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

S3 vs. S4: parallel lists

1 view
Skip to first unread message

Jonathan Lang

unread,
Jan 4, 2006, 2:58:38 AM1/4/06
to perl6-language@perl.org List
I think there might be a discrepency between S3 and S4.

S3:
> In order to support parallel iteration over multiple arrays,
> Perl 6 has a zip function that builds tuples of the elements of
> two or more arrays.
>
> for zip(@names; @codes) -> [$name, $zip] {
> print "Name: $name; Zip code: $zip\n";
> }
>
> zip has an infix synonym, the Unicode operator ¥.
>
> To read arrays in parallel like zip but just sequence the
> values rather than generating tuples, use each instead of zip.
>
> for each(@names; @codes) -> $name, $zip {
> print "Name: $name; Zip code: $zip\n";
> }

S4:
> To process two arrays in parallel, use either the zip function:
>
> for zip(@a;@b) -> $a, $b { print "[$a, $b]\n" }
>
> or the "zipper" operator to interleave them:

Shouldn't S4 replace "zip" with "each"?

--
Jonathan "Dataweaver" Lang

Larry Wall

unread,
Jan 4, 2006, 5:49:29 PM1/4/06
to perl6-language@perl.org List
On Tue, Jan 03, 2006 at 11:58:38PM -0800, Jonathan Lang wrote:
: I think there might be a discrepency between S3 and S4.

You are correct--S4 was out of date. Thanks.

Larry

0 new messages