python from toolz import compose, pipe, curry from functools import reduce add_one = lambda x: x + 1 double = lambda x: x * 2 square = lambda x: x ** 2 composed_func = compose(add_one, double, square) piped_func = pipe(square, double, add_one) mult = curry(lambda x, y: x * y) double_func = mult(2) lst = [1, 2, 3, 4, 5] transformed_lst = list(map(composed_func, lst)) sum_of_squares = reduce(lambda acc, x: acc + x, map(square, lst))


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