develooper Front page | perl.perl6.language | Postings from April 2005

junctions as indicies

Thread Next
From:
David Christensen
Date:
April 18, 2005 15:53
Subject:
junctions as indicies
Message ID:
2c69cb83b0b7eb9bd6c6c5caf26c4a1e@dwci.net
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


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