SIGN IN SIGN UP

add `tap` for side effects in pipelines (#61340)

several other languages have a construct like this so maybe julia should
as well? basically `tap` just lets you insert side effects into `|>`
chains, kind of like how `@aside` in `Chain.jl` does. but it's pretty
basic and I think useful for more than just data sciency pipelines so
might deserve a spot in `Base`

see also:
[Ruby: `tap`](https://ruby-doc.org/core-2.7.1/Object.html#method-i-tap)
[Kotlin:
`also`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/also.html)
[Elixir: `tap`](https://hexdocs.pm/elixir/Kernel.html#tap/2)
[Scala:
`tap`](https://www.scala-lang.org/api/current/scala/util/ChainingOps.html)
[Rust: `inspect` (kinda)](
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.inspect)

probably would close https://github.com/JuliaLang/julia/issues/25233 in
the negative for reserved syntax but in the positive for the spirit of
the request.

also potentially could combine it with the proposal in
https://github.com/JuliaLang/julia/issues/47200

---------

Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
A
Andy Dienes committed
723828b2c4e145d49b41a607f6a154c0694f60df
Parent: 8bdf88f
Committed by GitHub <noreply@github.com> on 5/7/2026, 11:41:14 PM