pip install cytoolz python from cytoolz import filter numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] even_numbers = list(filter(lambda x: x % 2 == 0, numbers)) print(even_numbers) [2, 4, 6, 8, 10] python from cytoolz import compose square = lambda x: x * x double = lambda x: x * 2 square_and_double = compose(double, square) numbers = [1, 2, 3, 4, 5] result = list(map(square_and_double, numbers)) print(result) [2, 8, 18, 32, 50] python from cytoolz import parallel_map numbers = [1, 2, 3, 4, 5] result = list(parallel_map(lambda x: x * x, numbers)) print(result) [1, 4, 9, 16, 25] python from cytoolz import concat data = [range(1000000) for _ in range(10)] flattened_data = list(concat(data)) print(len(flattened_data)) 10000000


上一篇:
下一篇:
切换中文