|
6 | 6 | 'true', 'stop', 'gen', 'chunked', 'otherwise', 'custom_dir', 'AttrDict', 'type_hints', 'annotations', |
7 | 7 | 'anno_ret', 'argnames', 'with_cast', 'store_attr', 'attrdict', 'properties', 'camel2words', 'camel2snake', |
8 | 8 | 'snake2camel', 'class2attr', 'getattrs', 'hasattrs', 'setattrs', 'try_attrs', 'GetAttrBase', 'GetAttr', |
9 | | - 'delegate_attr', 'ShowPrint', 'Int', 'Str', 'Float', 'concat', 'detuplify', 'replicate', 'setify', 'merge', |
10 | | - 'range_of', 'groupby', 'last_index', 'filter_dict', 'filter_keys', 'filter_values', 'cycle', 'zip_cycle', |
11 | | - 'sorted_ex', 'not_', 'argwhere', 'filter_ex', 'range_of', 'renumerate', 'first', 'nested_attr', 'nested_idx', |
12 | | - 'val2idx', 'uniqueify', 'num_methods', 'rnum_methods', 'inum_methods', 'fastuple', 'arg0', 'arg1', 'arg2', |
13 | | - 'arg3', 'arg4', 'bind', 'map_ex', 'compose', 'maps', 'partialler', 'instantiate', 'using_attr', 'Self', |
14 | | - 'Self', 'copy_func', 'patch_to', 'patch', 'patch_property', 'ImportEnum', 'StrEnum', 'str_enum', 'Stateful', |
15 | | - 'PrettyString', 'even_mults', 'num_cpus', 'add_props', 'typed'] |
| 9 | + 'delegate_attr', 'ShowPrint', 'Int', 'Str', 'Float', 'concat', 'strcat', 'detuplify', 'replicate', 'setify', |
| 10 | + 'merge', 'range_of', 'groupby', 'last_index', 'filter_dict', 'filter_keys', 'filter_values', 'cycle', |
| 11 | + 'zip_cycle', 'sorted_ex', 'not_', 'argwhere', 'filter_ex', 'range_of', 'renumerate', 'first', 'nested_attr', |
| 12 | + 'nested_idx', 'val2idx', 'uniqueify', 'num_methods', 'rnum_methods', 'inum_methods', 'fastuple', 'arg0', |
| 13 | + 'arg1', 'arg2', 'arg3', 'arg4', 'bind', 'mapt', 'map_ex', 'compose', 'maps', 'partialler', 'instantiate', |
| 14 | + 'using_attr', 'Self', 'Self', 'copy_func', 'patch_to', 'patch', 'patch_property', 'ImportEnum', 'StrEnum', |
| 15 | + 'str_enum', 'Stateful', 'PrettyString', 'even_mults', 'num_cpus', 'add_props', 'typed'] |
16 | 16 |
|
17 | 17 | # Cell |
18 | 18 | from .imports import * |
@@ -424,6 +424,11 @@ def concat(colls)->list: |
424 | 424 | "Concatenate all collections in `colls`" |
425 | 425 | return list(itertools.chain.from_iterable(colls)) |
426 | 426 |
|
| 427 | +# Cell |
| 428 | +def strcat(its, sep:str='')->str: |
| 429 | + "Concatenate stringified items `its`" |
| 430 | + return sep.join(map(str,its)) |
| 431 | + |
427 | 432 | # Cell |
428 | 433 | def detuplify(x): |
429 | 434 | "If `x` is a tuple with one thing, extract it" |
@@ -645,6 +650,11 @@ def __call__(self, *args, **kwargs): |
645 | 650 | fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:] |
646 | 651 | return self.func(*fargs, **kwargs) |
647 | 652 |
|
| 653 | +# Cell |
| 654 | +def mapt(func, *iterables): |
| 655 | + "Tuplified `map`" |
| 656 | + return tuple(map(func, *iterables)) |
| 657 | + |
648 | 658 | # Cell |
649 | 659 | def map_ex(iterable, f, *args, gen=False, **kwargs): |
650 | 660 | "Like `map`, but use `bind`, and supports `str` and indexing" |
|
0 commit comments