RE: arrays/sequences in DOS version
- Posted by Chris Bensler <bensler at mail.com> Apr 17, 2002
- 372 views
Welcome aboard darceman :) A sequence IS an array. EG. (hopefully it doesn't get mangled) -- qbasic dim somearray(2,2) -- euphoria Y sequence somearray somearray= {{0,0},-- X {0,0}} To break it down further: sequence dim2 dim2 = repeat(0,2) -- {0,0} sequence dim1 dim1 = repeat(dim2,2) -- {{0,0},{0,0}} (somearray) Here is the EU equivalent of your bit of code: sequence somearray somearray = repeat(repeat(0,2),2) -- the columns are the first dimension (y) -- the rows are the second dimension (x) for y=1 to 2 do for x=1 to 2 do somearray[y][x] = x*y end for end for Depending on your computers capabilities, you can load any size of sequence with any number of dimensions in any form. I came from a QBasic background, and was also limited by the memory size. I've never had a problem in EU. EU automatically handles extended memory, and virtual memory, so it will use all onboard RAM, and when it runs out of that, it will use a swap file, only limited by the size of free space on your harddrive. Chris darceman wrote: > Hi everyone! > > I am brand new to Euphoria and want to port code from QuickBasic for > DOS. > > One thing I am unable to determine is the equivalent sequence procedure > for a multi-dimemsional array and how to fill it with variables. > > e.g. > > dim somearray(2,2) > for x=1 to 2 > for y=1 to 2 > somearray(x,y)=x*y > next y > next x > > I hope I can build really large arrays/sequences (up to 4 dimensions) > without encountering the memory limitations of QuickBasic. > > Many thanks. Looking very much forward to using this great language. > > Darceman > >