var assert = require('assert'),
    _ = require('lodash'),
    Value = require('./value'),
    Valueable = require('./valueable');

var List = function List(list) {
  assert.ok(list === null || typeof list === 'undefined' || _.isArray(list), 'List(): value must be an array (or null/undefined)');

  var ix, value;
  if (!(this instanceof List)) {
    return new List(list);
  }
  Value.apply(this);
  this._list = [];
  this._raw = [];
  if (!list || !list.length) {
    return;
  }
  for (ix = 0; ix < list.length; ix++) {
    value = (list[ix] instanceof Value) ? list[ix] : Valueable(list[ix]);
    this._list[ix] = value;
    this._list[ix]._parent = this;
    this._raw[ix] = value.val();
  }
};

List.prototype = new Value();

List.prototype.val = function List$val(ix) {
  assert.ok(ix === undefined || (typeof ix === 'number' && ix >= 0), 'List(): key must be undefined or a positive integer');

  var raw;
  if (typeof ix !== 'undefined') {
    raw = this._raw[ix];
  } else {
    raw = this._raw;
  }

  if (process.env.NODE_ENV !== 'production') {
    // return a clone in dev/test to ensure that you
    // cannot make your code work by directly modifying
    // the returned value. in production disable
    // this for speed
    return _.clone(raw);
  }
  return raw;
};

List.prototype._updateChild = function List$private$updateChild(child, rawValue) {
  var ix, found, raw;
  // figure out which key this child is
  for (ix = 0; ix < this._list.length; ix++) {
    if (this._list[ix] === child) {
      found = true;
      break;
    }
  }
  assert.ok(found, 'List(): child value not found');
  raw = _.clone(this._raw);
  raw[ix] = rawValue;
  Value.prototype.set.call(this, raw);
};

module.exports = List;
@@ -727,16 +727,1129 @@
 lue();%0A%0A
+List.prototype.push = function List$push(rawValue) %7B%0A  var value = (rawValue instanceof Value) ? rawValue : Valueable(rawValue);%0A  value._parent = this;%0A  this._list.push(value);%0A  this._updateChild(value, value.val());%0A%7D;%0A%0AList.prototype.pop = function List$pop() %7B%0A  var value = this._list.pop(),%0A      raw = _.clone(this._raw);%0A  if (!value) %7B%0A    return value;%0A  %7D%0A  value.destroy(); %0A  raw.pop();%0A  this._raw = raw;%0A  this._notify();%0A  return value;%0A%7D;%0A%0AList.prototype.unshift = function List$unshift(rawValue) %7B%0A  var value = (rawValue instanceof Value) ? rawValue : Valueable(rawValue);%0A  value._parent = this;%0A  this._list.unshift(value);%0A  this._updateChild(value, value.val());%0A%7D;%0A%0AList.prototype.shift = function List$shift() %7B%0A  var value = this._list.shift(),%0A      raw = _.clone(this._raw);%0A  if (!value) %7B%0A    return value;%0A  %7D%0A  value.destroy();%0A  raw.shift();%0A  this._raw = raw;%0A  this._notify();%0A  return value;%0A%7D;%0A%0AList.prototype.get = function List$get(ix) %7B%0A  assert.ok(typeof ix === 'number' && ix %3E= 0, 'List(): index must be undefined or a positive integer');%0A  return this._list%5Bix%5D;%0A%7D;%0A%0A
 List.pro
@@ -1963,19 +1963,21 @@
 List(): 
-key
+index
  must be
@@ -2526,11 +2526,13 @@
 ich 
-key
+index
  thi

implement basic List functions