4.3.7 Set rest

This operation is similar to ``set first value''. However, if a list is originally empty, ``set rest'' updates first itself, not rest of the list node that first points to.

The implementation is as follows:

void List_setrest(struct _List *pList, struct _List *pRest)
{
  if (!((struct _List *)pList)->first)
  {
    *((struct _List *)pList) = *(((struct _List *)pRest);
  }
  else
  {
    ((struct _List *)pList)->first->rest = *pRest;
  }
}



Copyright © 2006-09-27 by Tak Auyeung