After today's class I asked you about the possiblity to change the structure
of NENode in LRStruct code. I think NENode structure can be changed to:

private Object _dat;
private ANode _tail;

And the main corresponding changes for methods in NENode are as the following.
I think the important part here is that: even though the rest is a ANode, the
getRest() here returns LRStruct. So the outside visitor can do the recursion
through LRStruct.


NENode(Object dat, ANode tail) {
        _dat = dat;
  	_tail = tail;
    }

LRStruct getRest(LRStruct owner) {
        return new LRStruct(_tail);
    }

void setRest(LRStruct tail, LRStruct owner)	{
        _tail = tail.getHead;
    }

void insertFront(Object dat, LRStruct owner) {
        owner.setHead (new NENode (dat, this));
   }

Object removeFront(LRStruct owner) {
    	owner.setHead (_tail);
    	return _dat;
    }

I think in this way the visitor can use the same algo as in the original code.
The bad thing about this is that it generates new LRStruct(_tail) every time
you call getRest() for a LRStruct. It is kind of a waste of memory.