junctions as indicies

0 views
Skip to first unread message

David Christensen

unread,
Apr 18, 2005, 6:53:08 PM4/18/05
to perl6-l...@perl.org
I'm looking in S09, and reading about junctions. It seems to me that
if we have a junction $j which we use to index into an array or a hash,
it should DWIM and return a junction of the corresponding values.

@ar=[1..10];
%hash=(a=>1,b=>4,c=>7);

$j=1|2|3;
$k="a"|"c";

$u = @ar[$j]; # 2|3|4
$v = %hash{$k}; # 1|7

Does this make sense to others?

David

Luke Palmer

unread,
Apr 18, 2005, 7:01:23 PM4/18/05
to David Christensen, perl6-l...@perl.org

Well, if we replaced @ar[$j] with, say, @ar.get($j), what you're
proposing happens automatically. So I think that it's the right thing
to do.

Luke

Reply all
Reply to author
Forward
0 new messages