in reply to Rosetta code: Split an array into chunks
A solution that'll be hard to map to a different language (except perhaps Perl6):
sub TIESCALAR{bless[0,$_[1]],$_[0]} sub FETCH{${$_[0]}[0]++%${$_[0]}[1]?" ":"\n"}; sub chunk_array{tie local$",'main',shift;"@_\n";}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Rosetta code: Split an array into chunks
by ahmad (Hermit) on Sep 25, 2010 at 18:06 UTC |
In Section
Meditations