Re: 3 dimension array
- Posted by Juergen Luethje <jluethje at gmx.de> Aug 22, 2002
- 416 views
Hello Derek, cool idea to put this stuff into a function. Derek <ddparnell at bigpond.com> wrote: > 22/08/2002 12:03:07 PM, rforno at tutopia.com wrote: >> >> The repeat amount should not be a sequence, but it can be an atom, the floor >> of which is used to dimension the array. Marvellous Euphoria. Of course, no >> negative values. > Thanks Ricardo. Thus we get... > function DIMArray( sequence Dimension, object InitValue ) > sequence lNewArray So that the function works properly, when <InitValue> is an atom, <lNewArray> should be declared as object, shouldn't it? > if length(Dimension) = 0 then > return 0 > end if > lNewArray = InitValue > for i = length(Dimension) to 1 by -1 do > if atom(Dimension[i]) and Dimension[i] > 0 then > lNewArray = repeat(lNewArray, Dimension[i]) > else > return i > end if > end for > return lNewArray > end function > ---------- > Derek. Regards, Juergen