develooper Front page | perl.perl6.internals | Postings from September 2002

how to use MultiArray?

Thread Next
From:
Aldo Calpini
Date:
September 18, 2002 07:23
Subject:
how to use MultiArray?
Message ID:
76-1753894452.20020918162152@alos.it

I couldn't find any example of using a MultiArray PMC.
I tried on my own, but failed miserably.

from what I've seen, it seems that is impossible to
properly initialize a multidimensional MultiArray.

I've tried this:

        new P1, .MultiArray, 1000

        set P1[0;0], 1
        set P1[0;1], 2
        set P1[0;2], 3

        print "(0,0)="
        set I0, P1[0;0]
        print I0

        # prints:
        # (0,0)=3
        
        end

every assignment changes whe whole P1[0] array.
it seems to lose the 2nd dimension somehow, probably because
the "dimension" member of the PMC was never initialized.

how do I go on using this? what do we need to make it work?


cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About