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

Map on a multislice

4 views
Skip to first unread message

Joe Gottman

unread,
Jan 25, 2007, 9:52:16 PM1/25/07
to Perl6
When you call map on a multislice, does it do deep or shallow
iteration? I can see uses for both of these:

my @multislice = ([1,2], [3,4, 5]);

my @dims = map :shallow {+@$_} @multislice; # Want (2, 3)
my @changed_slice = map :deep {2 * $_ + 1} @multislice; # Want ([3, 5],
[7, 9, 11])

Obviously both should be possible, and if we have a multislice with more
than 2 dimensions we should be able to iterate at any level. So what is
the default iteration level and how do we override?

Joe Gottman

Joe Gottman

Dr.Ruud

unread,
Jan 26, 2007, 4:27:04 AM1/26/07
to perl6-l...@perl.org
Joe Gottman schreef:

> When you call map on a multislice, does it do deep or shallow
> iteration?

And with deep, there is the choice: depth first or not.

--
Affijn, Ruud

"Gewoon is een tijger."

0 new messages