Iterate through multiple lists or arrays of equal size
428650
def _izip(*iterables):
    
    # This izip routine is from itertools
    # izip('ABCD', 'xy') --> Ax By

    iterators = map(iter, iterables)
    while iterators:
        yield tuple(map(next, iterators))
1276032
def _ensure_array_list(arrays):
    """"""
    # Note: the isinstance test is needed below so that instances of FieldArray
    # are not converted to numpy arrays
    return [numpy.array(arr, ndmin=1) if not isinstance(arr, numpy.ndarray)
            else arr for arr in arrays]
784611
public void printCoordinate(int[] index, long[] data, int offset) {
        int size = index.length;
        if (size != data.length)
            throw new IllegalArgumentException(
                    "All arrays must be of the same size");
        for (int i = 0; i < size; ++i)
            format(Locale.ENGLISH, "%10d %10d%n", index[i] + offset, data[i]);
    }
499194
def chunks(data, size):
    
    it = iter(data)
    for i in range(0, len(data), size):
        yield {k: data[k] for k in islice(it, size)}
1074622
def n_at_a_time(
    items: List[int], n: int, fillvalue: str
) -> Iterator[Tuple[Union[int, str]]]:
    
    it = iter(items)
    return itertools.zip_longest(*[it] * n, fillvalue=fillvalue)
795571
def p_array(self,t):
    
    if len(t)==4: t[0] = ArrayLit(t[2].children)
    elif len(t)==5: t[0] = ArrayLit(t[3].children)
    else: raise NotImplementedError('unk_len',len(t)) # pragma: no cover
1163112
def window(iterable, size=2):
    '''  '''
    iterable = iter(iterable)
    d = deque(islice(iterable, size-1), maxlen=size)
    for _ in map(d.append, iterable):
        yield tuple(d)
1134020
def lsummult (list1,list2):
    
    if len(list1) != len(list2):
        raise ValueError("Lists not equal length in summult.")
    s = 0
    for item1,item2 in pstat.abut(list1,list2):
        s = s + item1*item2
    return s
366506
def pieces(array, chunk_size):
        """"""
        for i in range(0, len(array), chunk_size): yield array[i:i+chunk_size]
464024
def chunk_iter(iterable, chunk_size):
    ''' '''
    while True:
        chunk = []
        try:
            for _ in range(chunk_size): chunk.append(next(iterable))
            yield chunk
        except StopIteration:
            if chunk: yield chunk
            break
166307
def chunks(iterable, chunk):
    """"""
    for i in range(0, len(iterable), chunk):
        yield iterable[i:i + chunk]
434471
private static int[] toIntArray(List<Integer> list) {
		int[] array = new int[list.size()];
		int i = 0;
		for (Integer intObj : list) {
			array[i++] = toInt(intObj);
		}
		return array;
	}
464333
def minibatch(items, size=8):
    
    if isinstance(size, int):
        size_ = itertools.repeat(size)
    else:
        size_ = size
    items = iter(items)
    while True:
        batch_size = next(size_)
        batch = list(itertools.islice(items, int(batch_size)))
        if len(batch) == 0:
            break
        yield list(batch)
284974
def _all_correct_list(array):
    
    if type(array) not in _ITERABLE_TYPES:
        return False

    for item in array:
        if not type(item) in _ITERABLE_TYPES:
            return False

        if len(item) != 2:
            return False

    return True
365244
function arrayEach$1(array, iteratee) {
  var index = -1,
      length = array == null ? 0 : array.length;

  while (++index < length) {
    if (iteratee(array[index], index, array) === false) {
      break;
    }
  }
  return array;
}
238975
public static void iterate(int dimension, int n, int[] size, int[] res, int dimension2, int n2, int[] size2,
                               int[] res2, CoordinateFunction func) {
        if (dimension >= n || dimension2 >= n2) {
            // stop clause
            func.process(ArrayUtil.toLongArray(res), ArrayUtil.toLongArray(res2));
            return;
        }

        if (size2.length != size.length) {
            if (dimension >= size.length)
                return;
            for (int i = 0; i < size[dimension]; i++) {
                if (dimension2 >= size2.length)
                    break;
                for (int j = 0; j < size2[dimension2]; j++) {
                    res[dimension] = i;
                    res2[dimension2] = j;
                    iterate(dimension + 1, n, size, res, dimension2 + 1, n2, size2, res2, func);
                }

            }
        } else {
            if (dimension >= size.length)
                return;

            for (int i = 0; i < size[dimension]; i++) {
                for (int j = 0; j < size2[dimension2]; j++) {
                    if (dimension2 >= size2.length)
                        break;
                    res[dimension] = i;
                    res2[dimension2] = j;
                    iterate(dimension + 1, n, size, res, dimension2 + 1, n2, size2, res2, func);
                }

            }
        }
    }
142851
function interleave(...arrays) {
  var more = true;
  var n = 0;
  var result = [];
  while (more) {
    more = false;
    for (var array of arrays) {
      if (n >= array.length) continue;
      result.push(array[n]);
      more = true;
    }
    n++;
  }
  return result;
}