Zhuang Li wrote:
Yes. I think it's both useful and fun. I was thinking something similar
to
@[EMAIL PROTECTED] = map{1} @a;


But getting "$hash->{E1}->{E2}->...->{En} = 1;" instead of "$hash{E1} =
1; ... $hash{En} =1;".

What I'd really like to do is:

Given @a = ('E1', 'E2', ..., 'En');
        @b = ('K1', 'K2', ..., 'Km');
        @c = ('V1', 'V2', ..., 'Vm');

To get the following in one line:
$hash->{E1}->...->{En}->{K1} = 'V1';
$hash->{E1}->...->{En}->{K2} = 'V2';
....
$hash->{E1}->...->{En}->{Km} = 'Vm';


I'll attempt a quess based on S03 & S04 & S09. ( http://dev.perl.org/perl6/synopsis/ )

S09 says that @nums[dims 0..2] means @nums[0;1;2]
S09 also says that "Everything we've said for arrays applies to hashes as well ..."
S04 tells how to process several lists in parallel in for-loop.
S03 tells about unary * list-flattening op.


So what about:

    for @b ¥ @c -> $b, $c { $hash->{dims ([EMAIL PROTECTED],$b)} = $c }

ps. I'm not 100% sure if I got that ([EMAIL PROTECTED],$b) right. I want to add $b to @a and feed it to dims as one list.

--
Markus Laire
<Jam. 1:5-6>

Reply via email to