Map a function over a List.
772568
def map(self, mapper: Callable[[Any], Any]) -> 'List':
        """"""
        try:
            ret = List.from_iterable([mapper(x) for x in self])
        except TypeError:
            ret = List.from_iterable([partial(mapper, x) for x in self])
        return ret
976846
def nested_map(x, f):
  """"""
  if isinstance(x, list):
    return [nested_map(y, f) for y in x]
  if isinstance(x, tuple):
    return tuple([nested_map(y, f) for y in x])
  if isinstance(x, dict):
    return {k: nested_map(x[k], f) for k in x}
  return f(x)
959168
function map(fn, ctx) {
  assert.equal(typeof fn, 'function')
  return function(val) {
    val = Array.isArray(val) ? val : [val]
    return Promise.all(val.map(fn, ctx))
  }
}
607345
function (list, func, args, selector) {
				for (var i = 0, j = list.length; i < j; i++) {
					list[i][func].apply(list[i], args);
				}
				return selector(list);
			}
2363
function commutate(key, list) {
    _.each(list, function (v, k, l) {
        if (k === key) {
            l[key] = true
        }
        if (v === true && k !== key) {
            l[k] = false
        }
    })
}
975804
@SuppressWarnings("unchecked")
    public static <From, To> List<To> map(List<From> list, MapClosure<From,To> f) {
        List<To> result = new ArrayList<To>(list.size());
        for (From value : list) {
            result.add( f.eval(value) );
        }
        return result;
    }
648298
def map_column(self, keys, func):
        
        return [[func(v) for v in self[key]] for key in keys]
1285406
def varmap(func, var, context=None, name=None):
    
    if context is None:
        context = {}
    objid = id(var)
    if objid in context:
        return func(name, '<...>')
    context[objid] = 1
    if isinstance(var, (list, tuple)):
        ret = [varmap(func, f, context, name) for f in var]
    else:
        ret = func(name, var)
        if isinstance(ret, dict):
            ret = dict((k, varmap(func, v, context, k))
                       for k, v in iteritems(var))
    del context[objid]
    return ret
274865
function each(list, fn) {
  var len = list ? list.length : 0;
  var i = 0;
  for (; i < len; ++i) {
    fn(list[i], i);
  }
  return list
}
1230146
def flat_map(iterable, func):
    """"""
    results = []
    for element in iterable:
        result = func(element)
        if len(result) > 0:
            results.extend(result)
    return results
420078
def visit(d, op):
    """"""
    op(d)
    if isinstance(d, list):
        for i in d:
            visit(i, op)
    elif isinstance(d, dict):
        for i in itervalues(d):
            visit(i, op)
425984
def map_plus(target: Callable, mi, ma, a, mk, k):
    """"""
    if a is None:
        a = []
    if k is None:
        k = {}

    if mi is None and ma is None and mk is None:
        return []
    elif mi is None and ma is None:
        return [target(*a, **mki, **k) for mki in mk]
    elif ma is None and mk is None:
        return [target(mii, *a, **k) for mii in mi]
    elif mk is None and mi is None:
        return [target(*mai, *a, **k) for mai in ma]
    elif mi is None:
        return [target(*mai, *a, **mki, **k) for mai, mki in zip(ma, mk)]
    elif ma is None:
        return [target(mii, *a, **mki, **k) for mii, mki in zip(mi, mk)]
    elif mk is None:
        return [target(mii, *mai, *a, **k) for mii, mai in zip(mi, ma)]
    else:
        return [target(mii, *mai, *a, **mki, **k) for mii, mai, mki in zip(mi, ma, mk)]
8070
def filter(self, f):
        
        def func(iterator):
            return filter(f, iterator)
        return self.mapPartitions(func, True)
747241
def flatMap(f: Callable, xs: Iterable) -> List:
    
    return flatten(lmap(f, xs))
503161
def uniq_by(self, func: Callable[[T], Any]) -> 'TList[T]':
        
        rs = TList()
        for e in self:
            if func(e) not in rs.map(func):
                rs.append(e)
        return rs
719226
def map_values(f, D):
    ''''''
    return { key:f(val) for key,val in D.iteritems() }
662902
private static <A, B> Map<A, B> listToMap(List<Map.Entry<A, B>> list) {
    Map<A, B> result = new LinkedHashMap<A, B>();
    for (Iterator<Map.Entry<A, B>> it = list.iterator(); it.hasNext();) {
      Map.Entry<A, B> entry = (Map.Entry<A, B>) it.next();
      result.put(entry.getKey(), entry.getValue());
    }
    return result;
  }