python from toolz import filter, groupby, map data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] filtered_data = list(filter(lambda x: x % 2 == 0, data)) grouped_data = groupby(lambda x: x % 2, data) mapped_data = list(map(lambda x: x * 2, data)) python from toolz import compose, curry, memoize def add(a, b): return a + b def multiply(a, b): return a * b composed_func = compose(multiply, add) curried_func = curry(add) memoized_func = memoize(add) python from toolz import thread_last def add(a, b): return a + b def multiply(a, b): return a * b def square(num): return num ** 2 data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] result = thread_last(data, (filter, lambda x: x % 2 == 0), (map, square), (map, curry(add)(5)), (map, curry(multiply)(2)) ) print(result)


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