[Coco] Basic09 Linked Lists

Wayne Campbell asa.rand at gmail.com
Fri May 24 22:23:23 EDT 2019


Yes, there is a BYTE data type. However, used in the context indicated,
those values would probably be converted to integers anyway, and keeping
them as integers means you can have a larger list. Byte is limited to 256
(0-255) whereas integer allows 32768 (0-32767).

Wayne

On Fri, May 24, 2019, 3:15 PM Joel Rees <joel.rees at gmail.com> wrote:

> 2019年5月22日(水) 8:13 Aaron <manney at gmail.com>:
>
> > Hi all,
> >
> > I found a snippet of code for a linked list, which is essentially an
> array
> > of `type`s:
> >
> > TYPE link_pointers = fwd,back: INTEGER
> > TYPE element = data: STRING[64]; ptr: link_pointers
> > DIM list(100): element
> >
> > Is this the best way to make a linked list in Basic09?  Or is there a
> > better implementation out there?  Ideally, I'd love to use it without
> > having to pre-define the length of the array.  But, unless things have
> > changed in the last 20 years, I'm aware of the limitations of Basic09.
> :)
> >
> > Thanks.
> >
>
> Is there a BYTE in Basic09? If your list has only 127 or less, a byte index
> would be a way to save a byte per link per record. It does entail some
> extra tests for out-of bounds links, for safety, however.
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list