// Generated by IcedCoffeeScript 1.6.3-g
(function() {
  var List;



  exports.List = List = (function() {
    function List() {
      this._head = null;
      this._tail = null;
    }

    List.prototype.head = function() {
      return this._head;
    };

    List.prototype.tail = function() {
      return this._tail;
    };

    List.prototype.push = function(o) {
      o.__list_prev = this._tail;
      o.__list_next = null;
      if (this._tail) {
        this._tail.__list_next = o;
      }
      this._tail = o;
      if (!this._head) {
        return this._head = o;
      }
    };

    List.prototype.walk = function(fn) {
      var next, p;
      p = this._head;
      while (p) {
        next = p.__list_next;
        if (!fn(p)) {
          break;
        }
        p = next;
      }
      return true;
    };

    List.prototype.remove = function(w) {
      var next, prev;
      next = w.__list_next;
      prev = w.__list_prev;
      if (prev) {
        prev.__list_next = next;
      } else {
        this._head = next;
      }
      if (next) {
        next.__list_prev = prev;
      } else {
        this._tail = prev;
      }
      w.__list_next = null;
      return w.__list_prev = null;
    };

    return List;

  })();

}).call(this);
