# Linked lists

A collection of helpers around linked lists.

llnext    ll -- ll   Yield next LL element.
ll>data   ll -- a    Yield the data associated to a LL element (add 4).
llend     ll -- ll   Iterate LL until we reach the last element.
llappend  elem ll -- Append "elem" at the end of "ll".
lladd     ll --      Write a new LL element to here then write its address to
                     the last element of "ll".
llprepend ll --      Write a new LL element that points to "ll".
llinsert  elem ll -- Insert "elem" between "ll" and its next element. If "ll"
                     is the last element of the list, this is equivalent to
                     "llappend".
llcnt     ll -- n    Yield the number of elements in "ll".

llfind ( elem ll -- idx prev-or-0 )
  Iterates "ll" until "elem" is found and yields its previous element as "prev"
  as well as "idx" being the index of the element.

  "elem" cannot be the same as "ll" and therefore, the resulting "idx" will
  never be 0.

  If the element is not found, prev=0 and idx is the number of elements in the
  LL.

llitern ( n ll -- prev elem-or-0 )
  Iterate "n" time in "ll" and return the resulting element or 0 if end of list
  was reached. Also, yield the previous element as "prev". If "elem" is 0,
  "prev" is the last element of the LL.
