20/11/06 13:23:23.40 1EHNC/LO.net
>>902 Perl5
use feature qw{current_sub say};
use Data::Dump 'dump';
@a = sub{
my $l = pop;
@_ ? ( map{
sub{
map{
sub{
sub{
push @{$_[$_]}, $l;
[@_]
}->(map{[@$_]} @_);
}->(@_)
} 0..@_
}->(@$_)
} __SUB__->(@_) ) : [[$l]];
}->(1..8);
say dump @a;
say scalar @a;
実行結果
~ $ perl 18_892.pl
(
[[1 .. 8]],
[[1 .. 7], [8]],
… 中略
[[1], [2], [3], [4], [5], [6], [7, 8]],
[[1], [2], [3], [4], [5], [6], [7], [8]],
)
4140