Sequences

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

Greg Harris writes:
> I have a quick question about sequences. How do I construct a
> multidimensional type array with sequences? For example, in Basic I
> would use:

> Dim dataarray(3,6,4,3)

In Euphoria you could construct this as:

   sequence dataarray
   dataarray = repeat(repeat(repeat(repeat(0,3),4),6),3)

Note the reverse order: 3 4 6 3

You could then access individual elements with:
   dataarray[h][i][j][k]

In BASIC subscripts start at 0.
In Euphoria they start at 1.

In Euphoria you aren't limited to "rectangular"
shapes for your multi-dimensional arrays.
For example, each "row" of a 2-d array (sequence) could be
a different length. Also, in Euphoria you can grow or shrink
your multi-dimensional sequence along any dimension at any time
without having to discard all your data, like some Basics require
when you "redim".

Regards,
  Rob Craig
  Rapid Deployment Software

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

Search



Quick Links

User menu

Not signed in.

Misc Menu