On Vendredi 29 Novembre 2002 19:02, you wrote:
> > Speaking of limitations, what can hold a multiarray? Only integers,
> > only strings, only pmc, a mix of everything?
> Everything a list can hold (i.e. all above, but no mix), though it
> would need a new class, which takes an list_type initializer. And
> datatypes smaller then INTVAL aren't done yet.

This makes me think... A PerlArray can hold PMCs... So I can have a 
PerlArray of PerlArrays:
        new P0, .PerlArray
        set P0[0], 54
        set P0[1], 45
        new P1, .PerlArray
        set P1[0], 19
        set P1[1], 10
        new P2, .PerlArray
        set P2[0], P0
        set P2[1], P1
        
        set P10, P2[1]
        set I0, P10[0]
        print I0
        print "\n"
        end

It seems to work, and it is (sort of) expandable in every dimension (so 
long as I'm carefully expand all the PerlArrays correctly). Is there 
any reason not to use this trick?


> >>s. docs/pdds/pdd02_vtable2.pod and the usage of these params in
> >>list.c /*
> >>  * list_new_init uses these initializers:
> >>  * 0 ... size (set initial size of list)
> >>  * 1 ... array dimensions (multiarray)
> >>  * 2 ... type (overriding type parameter)
> >>  * 3 ... item_size for enum_type_sized
> >>  * 4 ... items_per_chunk
> Not exactly: you set P1[n] to the initializer key '0' and P1[n+1] to
> the initializer data = size for key #0, and that is indeed 80x25.

I had a hard time to understand what you meant, but I (finally) got it. 
The initializer list works in pairs. So, I have two questions:
* why such a scheme, instead of using the indexes ot the list / array / 
perlarray?
* what are the mandatory fields? size and array dimensions?


> Please
> look again at the first test, which is an 2D array of 10x5.

Then, why does the test set the size to 100 instead of 50 (10*5)?
Maybe that's why I've been so long to understand the examples...


Jerome
-- 
[EMAIL PROTECTED]

Reply via email to