[<<][packetforth][>>][..]
Sun Feb 26 20:39:34 EST 2006

lists, stacks & queues

The list atom in packet forth has a 'last' pointer. Why do i
need that? To make queues. Now, it is possible to make queues using
just 2 stacks (singly linked lists). I thought of that before, but never
saw it was the key to clean up a lot in packet forth, mostly getting rid
of pf_list_t, pf_atom_t, and have a pf_pair_t, which is basicly like lisp
pairs with the restriction that it can only be used to build trees.

Then there's another thing i'd like to get rid of: the end-of-link pointer.

For the latter case, there's only:
xt>ct
xt>doc
xt>name
and linkhead, only used in debugging
for the rest, comma assumes code fields (primitives) and data fields have
a certain order. not too hard to change probably.

So, in order to clean up lists and atoms, which basicly means
* removing __last (replace by method)
* removing __elements (replace by method)
* unifying list and atom

We have to get rid of places where these are used as lvalues. The main
point of annoyance is the 'forth_sentinel' in

  pf_atom_link
  comma_to_link
  print_ip

and PF_XT_TO_LNK in the words above

What about temporarily setting XT=LINK?
it's supposed to be an abstract data type anyway.

WONT WORK!
This breaks "does>" which promotes an arbitrary atom pointer
to an xt, which is really what we want anyway..

so we'll have to go around it in another way, directly eliminating
the sentinel structure.




[Reply][About]
[<<][packetforth][>>][..]