Composition
from pyrula import pipe, flow, partial
# pipe threads a value through functionspipe(" Hello World ", str.strip, str.lower, lambda s: s.replace(" ", "-")) # "hello-world"
# flow builds a reusable function from the same stepsslugify = flow(str.strip, str.lower, lambda s: s.replace(" ", "-"))slugify(" Hello World ") # "hello-world"
# partial fixes leading arguments; the result works in pipe and flowdef clamp(lo, hi, x): return max(lo, min(hi, x))
partial(clamp, 0, 255)(300) # 255