function clusterBy(array, fn) {
  if (!array.length) { return []; }
  const aTail = tail(array);
  return aTail.reduce(function(memo, v) {
    const 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[]}