src/js/base/core/list.js
function (array, fn) {
      if (!array.length) { return []; }
      var aTail = tail(array);
      return aTail.reduce(function (memo, v) {
        var aLast = last(memo);
        if (fn(last(aLast), v)) {
          aLast[aLast.length] = v;
        } else {
          memo[memo.length] = [v];
        }
        return memo;
      }, [[head(array)]]);
    }
function (array, fn) {
      if (!array.length) { return []; }
      var aTail = tail(array);
      return aTail.reduce(function (memo, v) {
        var aLast = last(memo);
        if (fn(last(aLast), v)) {
          aLast[aLast.length] = v;
        } else {
          memo[memo.length] = [v];
        }
        return memo;
      }, [[head(array)]]);
    }
function ( array , fn ) { if ( ! array . length ) { return [ ] ; } var aTail = tail ( array ) ; return aTail . reduce ( function ( memo , v ) { var aLast = last ( memo ) ; if ( fn ( last ( aLast ) , v ) ) { aLast [ aLast . length ] = v ; } else { memo [ memo . length ] = [ v ] ; } return memo ; } , [ [ head ( array ) ] ] ) ; }
cluster elements by predicate function.

@param {Array} array - array
@param {Function} fn - predicate function for cluster rule
@param {Array[]}
cluster elements by predicate function .