This function reduces the dimensions of an array until it is
        no longer of length 1.
3277
def red_dim(self, array):
        
        while isinstance(array, list) == True or \
        isinstance(array, np.ndarray) == True:
            try:
                if len(array) == 1:
                    array = array[0]
                else:
                    break
            except:
                break

        return array
995531
function arraySampleSize(array, n) {
      return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
    }
1287457
private synchronized void trim() {
        while (mCurrentSize > mSizeLimit) {
            byte[] buf = mBuffersByLastUse.remove(0);
            mBuffersBySize.remove(buf);
            mCurrentSize -= buf.length;
        }
    }
338913
private void reduce() {
        Long[] keys = counter.asMap().keySet().toArray(ArrayUtils.EMPTY_LONG_OBJECT_ARRAY);
        Arrays.sort(keys);
        for (int i = 0, n = keys.length - maxNumBlocks + BUFFER_NUM_BLOCKS; i < n; i++) {
            counter.remove(keys[i]);
        }
    }
1136006
function removeFromList (array, obj) {
  for (var i = 0; i < array.length; i++) {
    if (array[i] === obj) {
      array.splice(i, 1);
    }
    return;
  }
}
1358746
function removeFromArray(array, value) {
    for (var i = 0; array && i < array.length; i++)
      if (array[i] === value)
        array['splice'](i--, 1);
  }
164552
function remove$1 (arr, item) {
	  if (arr.length) {
	    var index = arr.indexOf(item);
	    if (index > -1) {
	      return arr.splice(index, 1)
	    }
	  }
	}
611368
function compact (arr) {
  var idx = -1
  var end = arr.length
  var out = []

  while (++idx < end) {
    if (arr[idx]) out.push(arr[idx])
  }

  return out
}
19034
def pop(self,*args):
        '''
        
        '''
        nargs=len(args)
        dimlist=args[0] if isiterable(args[0]) else [args[0]]
        missing=args[1] if nargs > 1 else None 
        out=()
        for d in dimlist:
            out+=(super(dimStr, self).pop(d,missing),)
            if out[-1] == missing : self.set_ndims()
        
        return out if len(out) > 1 else out[0]
398127
function unflatten(valuesInOneDimension, size) {
  const {height, width} = size;
  const valuesInTwoDimensions = [];
  for (let y = 0; y < height; y++) {
    const start = y * width;
    const end = start + width;
    valuesInTwoDimensions.push(valuesInOneDimension.slice(start, end));
  }
  return valuesInTwoDimensions;
}
1001663
public boolean removeB(int index)
    {
        boundsCheck(index);
        boolean ret = array[index];
        for(int i = index; i < end-1; i++)
            array[i] = array[i+1];
        decreaseSize(1);
        return ret;
    }
489408
public void trimToSize()
    {
        if (elements.length != size && elements.length > INITIAL_CAPACITY)
        {
            elements = Arrays.copyOf(elements, Math.max(INITIAL_CAPACITY, size));
        }
    }
122888
protected void shortenChunkArray() {
        if (currentChunkMarker < 0)
            return;
        if (currentChunkMarker >= chunks.size()) {
            chunks.clear();
            return;
        }
        PdfChunk split = (PdfChunk)(chunks.get(currentChunkMarker));
        split.setValue(splittedChunkText);
        chunks.set(currentChunkMarker, currentStandbyChunk);
        for (int j = currentChunkMarker - 1; j >= 0; --j)
            chunks.remove(j);
    }
844553
public static int downSampleSize( int length , int squareWidth ) {
		int ret = length/squareWidth;
		if( length%squareWidth != 0 )
			ret++;

		return ret;
	}
216414
function _squeeze (array, dims, dim) {
  let i, ii

  if (dim < dims) {
    const next = dim + 1
    for (i = 0, ii = array.length; i < ii; i++) {
      array[i] = _squeeze(array[i], dims, next)
    }
  } else {
    while (Array.isArray(array)) {
      array = array[0]
    }
  }

  return array
}
862946
public void truncate(int newsize) {
    if(newsize < size) {
      double[] odists = dists;
      dists = new double[newsize];
      System.arraycopy(odists, 0, dists, 0, newsize);
      int[] oids = ids;
      ids = new int[newsize];
      System.arraycopy(oids, 0, ids, 0, newsize);
      size = newsize;
    }
  }
631280
function flatten(a) {
  function _reduce(a) { return a.reduce(_flatten, []); }

  function _flatten(a, b) {
    return a.concat(Array.isArray(b) ? _reduce(b) : b);
  }

  return _reduce(a);
}