# The nature of pipes

**URL:** <https://discourse.julialang.org/t/the-nature-of-pipes/103808>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [September 13, 2023, 10:52am UTC](https://discourse.julialang.org/t/the-nature-of-pipes/103808 "2023-09-13T10:52:14Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)\
**Post date:** [September 13, 2023, 3:07pm UTC](https://discourse.julialang.org/t/the-nature-of-pipes/103808/22 "2023-09-13T15:07:52Z")

</div>

> What about the other 15% of the time?

for these I would use `x ->` as before 🙂  
underscores also have a “15% ambiguity” for functions like `map(_, x)`, `filter(_, x)`

and realistically, I think front/back pipes have a (small but nonzero) chance of eventual inclusion, underscores have near-zero, so part of it is just an attempt to be economical with my advocacy

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [September 13, 2023, 3:11pm UTC](https://discourse.julialang.org/t/the-nature-of-pipes/103808/23 "2023-09-13T15:11:27Z")

</div>

> [@adienes](#):
>
> for these I would use `x ->` as before 🙂

To clarify, I was referring to the effect of #24990 on piping, not its effect on creating small anonymous functions like `2_` or `_ + 1`. If I have to use `x -> f(a, x, b)` in order to write a pipe, then I just won’t write a pipe at all.

---

<div class="post-metadata">

**Author:** ![ShalokShalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shalokshalom/32/52462_2.png) [@ShalokShalom](https://discourse.julialang.org/u/ShalokShalom)\
**Post date:** [September 13, 2023, 3:30pm UTC](https://discourse.julialang.org/t/the-nature-of-pipes/103808/24 "2023-09-13T15:30:30Z")

</div>

Is there already a forward facing function composition operator?  
So, one from left to right?

I have not seen one, and I would create an issue on Github, if there is none. 🙂 👌🏼

Of possible operators, I personally probably prefer something available as a ligature, so among:

 ![Screenshot_20230913_172806](https://global.discourse-cdn.com/julialang/original/3X/c/c/cc9b258e778fdef79bb5e8d7698d19d0e3ca5b78.png)  
 ![Screenshot_20230913_172928](https://global.discourse-cdn.com/julialang/original/3X/7/2/72d0129da4c9002e44a128a67f74e5f6943e2878.png)

---

<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:** [September 13, 2023, 5:36pm UTC](https://discourse.julialang.org/t/the-nature-of-pipes/103808/25 "2023-09-13T17:36:37Z")

</div>

> [@ShalokShalom](#):
>
> As an example: It seems like I need to plaster \_ all over the place.
> 
> Your documentation does mention, this is only necessary when it’s putted outside the “common argument order” - And I see not a single demonstration, that goes without an underscore.

Most often for generic data manipulation you need anonymous functions, and that’s why there are single underscores in those examples: as in `@p tbl |> map(_.field + 1)`.

For the common argument order and no anonymous functions, there’s no need for underscores: eg `@p tbl |> map(sum)` or `@p 1:10 |> filter(isodd) |> map(exp)`.

---

<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:** [September 13, 2023, 5:39pm UTC](https://discourse.julialang.org/t/the-nature-of-pipes/103808/26 "2023-09-13T17:39:22Z")

</div>

> [@ShalokShalom](#):
>
> Is there already a forward facing function composition operator?  
> So, one from left to right?

There is one in `CompositionsBase.jl`: `⨟`. The package has hundreds of dependents, but pretty sure not because they use this operator – `⨟` isn’t really used much.

---

<div class="post-metadata">

**Author:** ![ShalokShalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shalokshalom/32/52462_2.png) [@ShalokShalom](https://discourse.julialang.org/u/ShalokShalom)\
**Post date:** [September 13, 2023, 6:50pm UTC](https://discourse.julialang.org/t/the-nature-of-pipes/103808/27 "2023-09-13T18:50:11Z")

</div>

> [@aplavin](#):
>
> For the common argument order and no anonymous functions, there’s no need for underscores: eg `@p tbl |> map(sum)` or `@p 1:10 |> filter(isodd) |> map(exp)`.

I think that a valuable example, as this looks significantly more familiar.

[Previous page](https://discourse.julialang.org/t/the-nature-of-pipes/103808.md?page=1)
