Modifying the observers
ADT
element head(list* l) { head
require( ! empty(l) );
return l->e; // for both CONS and INTERVAL
}
list* tail(list* l) { tail
require( ! empty(l) );
switch( l->tag ) {
case CONS: return l->next;
case INTERVAL:
return interval((l->e)+1,l->z);
}
}
slide: Modifying the observers