in reply to Re^3: stack array to array of arrays
in thread stack array to array of arrays

ooooh - I like it; when it comes to the actual call it is small.
use feature 'state'; use List::MoreUtils qw(part); ... print oxTable->new([ part { state $i++ / $len } @array ]);
My problem is that it requires a lot of extra includes...
It also breaks down on the same edge ($len = 0);
It also requires a temp variable.
It may be worth it to just stay with.
sub arrayStack { my $len= pop; return map [splice @_,0,$len], 0..$#_/$len; } ... print oxTable->new([ arrayStack(@array,$len) ])

But it was a worthy exercise.... I actually never thought to use a counter as the inputted array and splicing off of the named array.

Replies are listed 'Best First'.
Re^5: stack array to array of arrays
by LanX (Saint) on Oct 17, 2013 at 17:57 UTC
    > It also breaks down on the same edge ($len = 0);

    No thats another edge! But what exactly is $len=0 supposed to mean?

    update

    > It may be worth it to just stay with. ...

    If I were you I would pass len as first parameter.

    > My problem is that it requires a lot of extra includes...

    feature is not an include but a pragma like strict.

    And IMHO List::MoreUtils should be put into core... (and extended)

    Cheers Rolf

    ( addicted to the Perl Programming Language)