Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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())
Example #4
0
 def iter_groupby(arg):
   arg = as_any_array(arg)
   return sorted([(k,len(list(g))) for k,g in groupby(sorted(arg))])
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
 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)
Example #8
0
 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())
Example #9
0
 def iter_groupby(arg):
     arg = as_any_array(arg)
     return sorted([(k, len(list(g))) for k, g in groupby(sorted(arg))])
Example #10
0
 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)
Example #11
0
 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)
Example #12
0
 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)