in reply to Re: Two handy tools for nested arrays: mapat and transpose
in thread Two handy tools for nested arrays: mapat and transpose

This is interesting. What part of OO do you think applies to this? You could decide that you have an N-dimensional matrix object and give it the matrixwise and multiply-composed methods. What of the mapat and transpose methods? Perhaps you give the mapat method to a multiply-nested array object. Does any of this tacking on of additional names to the functions buy you anything?

Would it be for the type conversion safety? Or is this just so that you can use the functions and still say you're using OO?

  • Comment on Re^2: Two handy tools for nested arrays: mapat and transpose

Replies are listed 'Best First'.
Re^3: Two handy tools for nested arrays: mapat and transpose
by NetWallah (Canon) on Dec 07, 2004 at 22:58 UTC
    The mapat method on a matrix object could give you a way to flatten it into an array. The transpose method could return a transposed matrix object, or transpose the current object in-place. but the real power would come from something like this:
    #assume $m1 and $m2 are matrix objects my $m3 = $m1->ApplyFunction(\&mysub, $m2); .... sub mysub{ my ($element1,$element2)=@_; return $element1 &#$((Some operation) $element2; }
    Makes for code simplicity.

        ...each is assigned his own private delusion but he cannot see the baggage on his own back.