anchor.diff:  part of dartz;
   
  -// (stack safety - tail call elimination) => icky mutating loops
  -// everything should be externally RT though and mostly stack safe.
  +// Internally implemented using imperative loops and mutations, for stack safety and performance.
  +// The external API should be safe and referentially transparent, though.
   
   abstract class IList<A> extends TraversableOps<IList, A> with FunctorOps<IList, A>, ApplicativeOps<IList, A>, ApplicativePlusOps<IList, A>, MonadOps<IList, A>, MonadPlusOps<IList, A>, TraversableMonadOps<IList, A>, TraversableMonadPlusOps<IList, A> {
     Option<A> get headOption;
  
positive.code:   }
  
    @override IList/*<B>*/ bind/*<B>*/(IList/*<B>*/ f(A a)) {
      List/*<B>*/ mresult = [];
      var current = this;
      while (current._isCons()) {
        final IList/*<B>*/ sublist = f(current._unsafeHead());
        var subcurrent = sublist;
        while (subcurrent._isCons()) {
          mresult.add(subcurrent._unsafeHead());
          subcurrent = subcurrent._unsafeTail();
        }
        current = current._unsafeTail();
      }
  
      IList/*<B>*/ result = nil();
      for (int i = mresult.length - 1; i >= 0; i--) {
        result = new Cons(mresult[i], result);
      }
      return result;
    }
  
    @override IList/*<B>*/ flatMap/*<B>*/(IList/*<B>*/ f(A a)) => bind(f);
  
    @override IList /*<B>*/ map/*<B>*/(/*=B*/ f(A a)) {
      List /*<B>*/ mresult = [];
      var current = this;
      while (current._isCons()) {
        mresult.add(f(current._unsafeHead()));
        current = current._unsafeTail();
      }
  
      IList /*<B>*/ result = nil();
      for (int i = mresult.length - 1; i >= 0; i--) {
        result = new Cons(mresult[i], result);
      }
      return result;
    }
  
negative.code:   bool _isCons() => false;
    A _unsafeHead() => throw new UnsupportedError("_unsafeHead called on _Nil");
    IList<A> _unsafeTail() => throw new UnsupportedError("_unsafeTail called on _Nil");
    void _unsafeSetTail(IList<A> newTail) => throw new UnsupportedError("_unsafeSetTail called on _Nil");
  
    @override Option<A> get headOption => none();
  
  