Original Author Paul Laughton, 2011
Page 45
De Re BASIC!
If you were to actually create such a database in BASIC!, you would probably want to save all these
Bundles and Lists onto external storage. Getting that information from the internal data structures to
external storage is an exercise left to the user for now.
There are things besides List, Bundle, and Stack data structures that are accessed through pointers.
These include bitmaps and graphical objects, described below in the Graphics section, audio clips,
described in SoundPool, and other things.
Lists
A List is similar to a single-dimension array. The difference is in the way a List is built and used. An array
must be dimensioned before being used. The number of elements to be placed in the array must be
predetermined. A List starts out empty and grows as needed. Elements can be removed, replaced and
inserted anywhere within the list.
There is no fixed limit on the size or number of lists. You are limited only by the memory of your device.
Another important difference is that a List is not a variable type. A numeric pointer is returned when a
list is created. All further access to the List is by means of that numeric pointer. One implication of this is
that it is easy to make a List of Lists. A List of Lists is nothing more than a numeric list containing numeric
pointers to other lists.
Lists may be copied into new Arrays. Arrays may be added to Lists.
All of the List commands are demonstrated in the Sample Program file, f27_list.bas.
List Commands
List.create N|S, <pointer_nvar>
Creates a new, empty list of the type specified by the N or S parameter. A list of strings will be created if
the parameter is S. A list of numbers will be created if the parameter is N. Do not put quotation marks
around the N or S.
The pointer to the new list will be returned in the <pointer_nvar> variable.
The newly created list is empty. The size returned for a newly created list is zero.
List.add <pointer_nexp>{, <exp>}...
Adds the values of the expressions <exp>... to specified list. The expressions must all be the same type
(numeric or string) as the list.
The list of <exp>s may be continued onto the next line by ending the line with the "~" character. The "~"
character may be used between <exp> parameters, where a comma would normally appear. The "~"
itself separates the parameters; the comma is optional.
The "~" character may not be used to split a parameter across multiple lines.