[Coco] Basic09 Linked Lists

Joel Rees joel.rees at gmail.com
Fri May 24 18:15:04 EDT 2019


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.


More information about the Coco mailing list