Sprout v0.0.27 — the pipe operator
The pipe operator |> — data flows left to right.
The last of four beloved features. x |> f is just f(x), and x |> f(a) is f(x, a) — the left value threads in as the first argument. It's left-associative, so a pipeline reads top to bottom instead of inside-out:
nums |> filter(task(n): n % 2 == 0) |> map(task(n): n * 10) |> sum
# == sum(map(filter(nums, …even…), …×10…)) -> 120
- The right side is a task or a call: a name (
|> double), a call with more arguments (|> add(2)), or a module call (|> server.handle(req)). - Binds looser than arithmetic (
2 + 3 |> doubleisdouble(5)) and tighter than comparisons. - Desugars to an ordinary call at parse time, so it reuses every existing call path (arity checks, task lookup, module calls) — nothing new at runtime, and the left side is evaluated exactly once.
It pairs beautifully with the rest of the batch — lambdas, ranges, and comprehensions all pipe cleanly ((1 to 5) |> map(double) |> sum).
A 2-lens adversarial review (+ verification) found zero issues. 18-check test suite; CI green on Linux, macOS, and Windows. Windows installer attached.
This completes the four-feature batch 🎉
- v0.0.24 — Lambdas + closures
- v0.0.25 — Ranges + comprehensions
- v0.0.26 — Pattern matching
- v0.0.27 — Pipe operator