hbutils.collection.functional¶
- Overview:
Function operations for nested structure.
nested_map¶
-
hbutils.collection.functional.
nested_map
(f, s)[source]¶ - Overview:
Map the nested structure with a function.
- Arguments:
f: The given function.
s: Nested structure.
- Returns:
result: Mapped nested structure.
- Examples::
>>> from hbutils.collection import nested_map >>> nested_map(lambda x: x + 1, [ ... 2, 3, (4, {'x': 2, 'y': 4}), ... {'a': 3, 'b': (4, 5)}, ... ]) [3, 4, (5, {'x': 3, 'y': 5}), {'a': 4, 'b': (5, 6)}]