Transform a for..in into it's iterative equivalent
325853
function transformForIn(node, path) {
        var label = node.$label;
        delete node.$label;
        var idx = ident(generateSymbol("idx"));
        var inArray = ident(generateSymbol("in"));
        var declVars = parsePart("var $0,$1 = [];for ($0 in $2) $1.push($0)", [idx,
            inArray,node.right]).body;
        var loop = parsePart("for ($0; $1.length;){ $2 = $1.shift(); $:3 ; }", [node.left,
            inArray,node.left.type === 'VariableDeclaration' ? node.left.declarations[0].id : node.left,
            node.body]).body[0];
        loop.$label = label;
        for (var b = 0;b < path.length; b++) {
            if (examine(path[b].parent).isBlockStatement) {
                path[b].parent[path[b].field].splice(path[b].index, 0, declVars[0], declVars[1]);
                break;
            }
        }
        coerce(node, loop);
    }
829972
function mapValues(obj, iteratee) {
  const result = {}
  for (const k in obj) {
    result[k] = iteratee(obj[k])
  }
  return result
}
1342337
def _zip_flatten(x, ys):
    '''
    
    '''
    return itertools.chain.from_iterable(
            zip(itertools.repeat(x), ys))
551568
def iterative_var_lookup(k)

      v = lookup_variable(k)

      return [ k, v ] unless (v.is_a?(String) or v.is_a?(Symbol))

      iterative_var_lookup(v)
    end
1175550
function transform(str, from, to) {
  let out = '';
  const escaped = '\\' + to;

  for (let i = 0; i < str.length; i++) {
    if (str[i] === to) {
      out += escaped;
    } else if (str[i] === from) {
      out += to;
    } else if (str[i] === '\\' && i + 1 < str.length && str[i + 1] === from) {
      out += from;
      i++;
    } else {
      out += str[i];
    }
  }
  return out;
}
234716
def iterate(matrix, expansion, inflation):
    
    # Expansion
    matrix = expand(matrix, expansion)

    # Inflation
    matrix = inflate(matrix, inflation)

    return matrix
665387
def pairwise(iterable):
    
    it = iter(iterable)
    a = next(it, None)

    for b in it:
        yield (a, b)
        a = b
1179882
function(input, shallow, output) 
	{
		if (shallow && conbo.every(input, conbo.isArray)) 
		{
			return concat.apply(output, input);
		}
		
		forEach(input, function(value) 
		{
			if (conbo.isArray(value) || conbo.isArguments(value)) 
			{
				shallow ? push.apply(output, value) : flatten(value, shallow, output);
			}
			else 
			{
				output.push(value);
			}
		});
		
		return output;
	}
1110273
def flatten_list(l):
    
    return list(chain.from_iterable(repeat(x,1) if isinstance(x,str) else x for x in l))
95383
def flatten_all(list_of_list):
    
    for i in list_of_list:
        if hasattr(i, "__iter__"):
            for j in flatten_all(i):
                yield j
        else:
            yield i
465231
def _in(x, y):
    
    try:
        return x.isin(y)
    except AttributeError:
        if is_list_like(x):
            try:
                return y.isin(x)
            except AttributeError:
                pass
        return x in y
338948
def _preprocess(inp):
        """"""
        inp = re.sub(r'(\b)a(\b)', r'\g<1>one\g<2>', inp)
        inp = re.sub(r'to the (.*) power', r'to \g<1>', inp)
        inp = re.sub(r'to the (.*?)(\b)', r'to \g<1>\g<2>', inp)
        inp = re.sub(r'log of', r'log', inp)
        inp = re.sub(r'(square )?root( of)?', r'sqrt', inp)
        inp = re.sub(r'squared', r'to two', inp)
        inp = re.sub(r'cubed', r'to three', inp)
        inp = re.sub(r'divided?( by)?', r'divide', inp)
        inp = re.sub(r'(\b)over(\b)', r'\g<1>divide\g<2>', inp)
        inp = re.sub(r'(\b)EE(\b)', r'\g<1>e\g<2>', inp)
        inp = re.sub(r'(\b)E(\b)', r'\g<1>e\g<2>', inp)
        inp = re.sub(r'(\b)pie(\b)', r'\g<1>pi\g<2>', inp)
        inp = re.sub(r'(\b)PI(\b)', r'\g<1>pi\g<2>', inp)

        def findImplicitMultiplications(inp):
            """Replace omitted 'times' references."""

            def findConstantMultiplications(inp):
                split = inp.split(' ')
                revision = ""

                converter = NumberService()
                for i, w in enumerate(split):
                    if i > 0 and w in MathService.__constants__:
                        if converter.isValid(split[i - 1]):
                            revision += " times"
                    if not revision:
                        revision = w
                    else:
                        revision += " " + w

                return revision

            def findUnaryMultiplications(inp):
                split = inp.split(' ')
                revision = ""

                for i, w in enumerate(split):
                    if i > 0 and w in MathService.__unaryOperators__:
                        last_op = split[i - 1]

                        binary = last_op in MathService.__binaryOperators__
                        unary = last_op in MathService.__unaryOperators__

                        if last_op and not (binary or unary):
                            revision += " times"
                    if not revision:
                        revision = w
                    else:
                        revision += " " + w

                return revision

            return findUnaryMultiplications(findConstantMultiplications(inp))

        return findImplicitMultiplications(inp)
198059
def flatten(self, l):
        """"""
        if l == []:
            return l
        if isinstance(l[0], list):
            return self.flatten(l[0]) + self.flatten(l[1:])
        return l[:1] + self.flatten(l[1:])
212234
function some(arr, iter) {
    arr = Immutable.List(arr);

    return arr.reduce(function(prev, elem, i) {
        return prev.then(function(val) {
            if (val) return val;

            return iter(elem, i);
        });
    }, Q());
}
970840
def to_d(l):
    
    _d = {}
    for x in l:
        for k, v in x.items():
            _d[k] = v
    return _d
413053
function(input, shallow, output) {
    if (shallow && _.every(input, _.isArray)) {
      return concat.apply(output, input);
    }
    each(input, function(value) {
      if (_.isArray(value) || _.isArguments(value)) {
        shallow ? push.apply(output, value) : flatten(value, shallow, output);
      } else {
        output.push(value);
      }
    });
    return output;
  }
216295
function flatten(array, i) {
  i = i || 0;

  if(i >= array.length)
    return array;

  if(isArray(array[i])) {
    return flatten(array.slice(0,i)
      .concat(array[i], array.slice(i+1)), i);
  }
  return flatten(array, i+1);
}