def naive_loop(arg,func=None): func = func or FuncMap._default_func arg = as_any_array(arg) out = [] for value in arg: out.append(func(value)) return as_any_array(out)
def dict1(arg,out=None): arg = as_any_array(arg) out = {} for val in arg: out[val] = out.get(val,0) + 1 return sorted(out.items())
def iter_groupby(arg): arg = as_any_array(arg) return sorted([(k,len(list(g))) for k,g in groupby(sorted(arg))])
def naive_comp(arg,mapping={},default=0): arg = as_any_array(arg) out = [mapping.get(value,default) for value in arg] return as_any_array(out)
def naive_loop(arg,mapping={},default=0): arg = as_any_array(arg) out = [] for value in arg: out.append(mapping.get(value,default)) return as_any_array(out)
def naive_comp(arg,func=None): func = func or FuncMap._default_func arg = as_any_array(arg) out = [func(value) for value in arg] return as_any_array(out)
def dict1(arg, out=None): arg = as_any_array(arg) out = {} for val in arg: out[val] = out.get(val, 0) + 1 return sorted(out.items())
def iter_groupby(arg): arg = as_any_array(arg) return sorted([(k, len(list(g))) for k, g in groupby(sorted(arg))])