# Is it possible to pipe to a function of several variables?

**URL:** <https://discourse.julialang.org/t/is-it-possible-to-pipe-to-a-function-of-several-variables/76393>\
**Category:** General Usage\
**Tags:** question, piping\
**Created:** [February 14, 2022, 7:32am UTC](https://discourse.julialang.org/t/is-it-possible-to-pipe-to-a-function-of-several-variables/76393 "2022-02-14T07:32:41Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [February 14, 2022, 1:07pm UTC](https://discourse.julialang.org/t/is-it-possible-to-pipe-to-a-function-of-several-variables/76393/9 "2022-02-14T13:07:51Z")

</div>

To my understanding, one of the major differences between piping packages lies in where exactly they put the result of the previous pipe step.

`DataPipes.jl` ([[ANN] DataPipes.jl](https://discourse.julialang.org/t/ann-datapipes-jl/60734)): the previous result becomes the _last_ function argument by default. This is ideal for common data processing workflows: think functions like `map` and `filter` - that’s where `Data` in the package name comes from.  
Of course, one can manually use the previous result anywhere with `__`:

```julia
@p [(a=1, b=2), (a=3, b=4)] |>
	map(_.a + _.b + 2) |>
	first(__, 1)

```

_Disclaimer: I’m the author of `DataPipes.jl`_

`Chain.jl`: the previous result becomes the _first_ function argument by default. This is convenient for certain other functions and ecosystems, but requires explicitly writing the placeholder in each step when using common data processing functions.

`Underscores.jl`: always requires specifying where the previous result goes. This adds some boilerplate for common cases, but makes other more general pipelines cleaner. See discussion later in the [[ANN] DataPipes.jl](https://discourse.julialang.org/t/ann-datapipes-jl/60734) thread.

There are other features and differences as well, most notably with anonymous functions, but I think they are less fundamental. See the `DataPipes.jl` usage notebook for more advanced examples: [https://aplavin.github.io/DataPipes.jl/examples/notebook.html](https://aplavin.github.io/DataPipes.jl/examples/notebook.html).

---

_[View the full topic](https://discourse.julialang.org/t/is-it-possible-to-pipe-to-a-function-of-several-variables/76393)._
