Re: 3 dimension array

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello Derek,

cool idea to put this stuff into a function. smile

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu