lib/MissMatch.js
function matchArray(m,a) {
    var from = 0, rest = false, restBindingResult, index, matcher, item,
    matchResult, restOfArray = [], i, result = {
      result: false,
      param: a
    };

    // If this isn't an array then it can't match
    if (!is(a, '[object Array]')) {
      return result;
    }

    // If there are more matchers than array elements it also can't match unless the
    // last matcher is a rest matcher
    if (m.length > a.length && !m[m.length - 1].name) {
      return result;
    }

    /**
     * If there are no predicates at all, this matches because it is 
     * already ensured that argument a is an array.
     */
    if(m.length === 0) {
      result.result = true;
      return result;
    }

    for(index=0;index<a.length;index++) {
      matcher = m[index];
      item = a[index];

      if(!matcher) {
        return result;
      }

      matchResult = matcher(item);
      if(!matchResult.result) {
        return result;
      }

      /**
       * If the rest of an array is matched, the predicate will
       * return an object that has a'rest' parameter. We can't
       * recognize the rest predicate by it's function name, because
       * it might be hidden behind a 'bind' call.
       */
      if(matchResult.rest) {
        restBindingResult = matchResult;
        from = index;
        rest = true;
        break;
      }
    }

    if(rest && restBindingResult.this_binding) {
      for(i = from; i < a.length; i++) {
        restOfArray[restOfArray.length] = a[i];
      }
      bindingContext[restBindingResult.this_binding] = restOfArray;
    }
    
    result.result = true;
    return result;
  }
function matchArray(m,a) {
    var from = 0, rest = false, restBindingResult, index, matcher, item,
    matchResult, restOfArray = [], i, result = {
      result: false,
      param: a
    };

    // If this isn't an array then it can't match
    if (!is(a, '[object Array]')) {
      return result;
    }

    // If there are more matchers than array elements it also can't match unless the
    // last matcher is a rest matcher
    if (m.length > a.length && !m[m.length - 1].name) {
      return result;
    }

    /**
     * If there are no predicates at all, this matches because it is 
     * already ensured that argument a is an array.
     */
    if(m.length === 0) {
      result.result = true;
      return result;
    }

    for(index=0;index<a.length;index++) {
      matcher = m[index];
      item = a[index];

      if(!matcher) {
        return result;
      }

      matchResult = matcher(item);
      if(!matchResult.result) {
        return result;
      }

      /**
       * If the rest of an array is matched, the predicate will
       * return an object that has a'rest' parameter. We can't
       * recognize the rest predicate by it's function name, because
       * it might be hidden behind a 'bind' call.
       */
      if(matchResult.rest) {
        restBindingResult = matchResult;
        from = index;
        rest = true;
        break;
      }
    }

    if(rest && restBindingResult.this_binding) {
      for(i = from; i < a.length; i++) {
        restOfArray[restOfArray.length] = a[i];
      }
      bindingContext[restBindingResult.this_binding] = restOfArray;
    }
    
    result.result = true;
    return result;
  }
m is an array of predicates, a is the array to match