from typing import Callable, Any from functools import reduce, partial def pipeline(*functions: Callable[[Any], Any]) -> Callable[[Any], Any]: """ Creates a pipeline from a sequence of functions. Usage: processor = pipeline(str.lower, str.split) processor("Hello World") # ['hello', 'world'] """ return partial(reduce, lambda x, f: f(x), functions)