Count the number of true values in an array
@param {Array} arr
@return {number}
19188
function count(arr) {
    var c = 0;
    for (var i = 0; i < arr.length; i++) {
        c += eightBits[arr[i] & 0xff] + eightBits[(arr[i] >> 8) & 0xff] + eightBits[(arr[i] >> 16) & 0xff] + eightBits[(arr[i] >> 24) & 0xff];
    }
    return c;
}
155634
function(arr) {
        for (var i = 0; i < arr.length; i++) {
          var randIndex = Math.floor(Math.random() * arr.length);
          var temp = arr[randIndex];
          arr[randIndex] = arr[i];
          arr[i] = temp;
        }
        return arr;
      }
173184
function(arr, iterator, callback) {
      callback = _doOnce(callback || noop);
      var amount = arr.length;

      if (!isArray(arr)) return callback();

      var completed = 0;
      doEach(arr, function(item) {
        iterator(item, doOnce(function(err) {
          if (err) {
            callback(err);
            callback = noop;
          } else {
            completed++;
            if (completed >= amount) callback(null);
          }
        }));
      });
    }
170510
function cp(arr) {
	var len = arr.length
	var ret = new Array(len)
	for (var i=0; i<len; i++) {ret[i] = arr[i]}
	return ret
}
766865
public static long numVectors(INDArray arr) {
        if (arr.rank() == 1)
            return 1;
        else if (arr.rank() == 2)
            return arr.size(0);
        else {
            int prod = 1;
            for (int i = 0; i < arr.rank() - 1; i++) {
                prod *= arr.size(i);
            }

            return prod;
        }
    }
668306
function array_sum (arr) {
		var ans = 0;
		for (k = 0; k < arr.length; k++) {
			ans += arr[k];
		}
		return ans;
	}
1072772
function(arr) {
      var n = [], l=arr.length,i;
      for(i = 0 ; i < l ; i++) {
         if( !lang.isNull(arr[i]) && !lang.isUndefined(arr[i]) ) {
            n.push(arr[i]);
         }
      }
      return n;
   }
280030
function contains(arr, element) {
        for (var i = 0, len = arr.length; i < len; i++) {
            if (arr[i] === element) {
                return true;
            }
        }
        return false;
    }
76503
function _eachArrayReverse(arry, fn) {
  let ret = true
  for (let i = arry.length - 1; i >= 0; i--) {
    ret = fn(arry[i], i, arry)
    if (ret === false) {
      break
    }
  }
  return ret
}
154205
function SetArr() {
  let arr = {}
  let set = {
    size: 0,
    clear() {
      set.size = 0
    },
    add(item) {
      let index = arr.indexOf(item)
      if (index !== -1) return arr
      arr.push(item)
      set.size = arr.length
      return set
    },
    delete(item) {
      let index = arr.indexOf(item)
      if (index === -1) return false
      arr.splice(index, 1)
      set.size = arr.length
      return true
    },
    [Symbol.iterator]: () => arr[Symbol.iterator]()
  }
  return set
}
689220
function avg(arr) {
    arr = arr || [];
    if (arr.length) {
        var total = sum(arr);
        if (number.isNumber(total)) {
            return total / arr.length;
        } else {
            throw new Error("Cannot average an array of non numbers.");
        }
    } else {
        return 0;
    }
}
696283
function sum (arr) {
    if (isArray(arr) && !(arr[0] instanceof Array)) {
        const filteredNumber = getFilteredValues(arr);
        const totalSum = filteredNumber.length ?
                            filteredNumber.reduce((acc, curr) => acc + curr, 0)
                            : InvalidAwareTypes.NULL;
        return totalSum;
    }
    return InvalidAwareTypes.NULL;
}
673895
public static int count(float[] array, float val) {
        int count = 0;
        for (int i=0; i<array.length; i++) {
            if (array[i] == val) {
                count++;
            }
        }
        return count;
    }
877461
def _value_counts_arraylike(values, dropna):
    
    values = _ensure_arraylike(values)
    original = values
    values, dtype, ndtype = _ensure_data(values)

    if needs_i8_conversion(dtype):
        # i8

        keys, counts = htable.value_count_int64(values, dropna)

        if dropna:
            msk = keys != iNaT
            keys, counts = keys[msk], counts[msk]

    else:
        # ndarray like

        # TODO: handle uint8
        f = getattr(htable, "value_count_{dtype}".format(dtype=ndtype))
        keys, counts = f(values, dropna)

        mask = isna(values)
        if not dropna and mask.any():
            if not isna(keys).any():
                keys = np.insert(keys, 0, np.NaN)
                counts = np.insert(counts, 0, mask.sum())

    keys = _reconstruct_data(keys, original.dtype, original)

    return keys, counts
883703
def count_values(*values)
      values.inject(Hash.new(0)) { |h, v| h[v] += 1; h }
    end
1073832
function needRecurseArray(arr) {
  for (var i = 0; i < arr.length; i++) {
    var el = arr[i]
    if (typeof el !== 'number' && typeof el !== 'string' && el != null) return true
  }
  return false
}
193753
function(arr, num) {
    if (isUndefined(num)) return arr[arr.length - 1];
    var start = arr.length - num < 0 ? 0 : arr.length - num;
    return arr.slice(start);
  }