# Fixing the Piping/Chaining Issue

**URL:** <https://discourse.julialang.org/t/fixing-the-piping-chaining-issue/89654>\
**Category:** Internals & Design\
**Tags:** proposal, piping, chaining, partial-evaluation, threading\
**Created:** [November 2, 2022, 11:04am UTC](https://discourse.julialang.org/t/fixing-the-piping-chaining-issue/89654 "2022-11-02T11:04:36Z")\
**Posts on this page:** 1\
**Showing post:** 146

<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:** [November 8, 2022, 9:27am UTC](https://discourse.julialang.org/t/fixing-the-piping-chaining-issue/89654/146 "2022-11-08T09:27:42Z")

</div>

I admit I haven’t read this thread fully, only skimmed it, but didn’t see actual examples implemented with the proposed syntax vs with already existing general solutions in packages. For ease of comparison, this would be great.

Personally, I now use (my) [DataPipes.jl](https://discourse.julialang.org/t/ann-datapipes-jl-0-3-0/60734) for piping. Below is an example of tabular data processing with it, showcasing main features — looks quite convenient and reads intuitive to me. Anything that can be improved further with new syntax?

```julia
using DataPipes, FlexiGroups

tbl = [(id=rand(1:2), day=Day(rand(1:10)), value=rand()) for _ in 1:30]

@p let
    tbl
    group((;_.id, _.day))
	map() do __
		filter(dayofweek(Date(2022) + _.day) ∈ 1:5)
		@aside @info "foobar" length(__)
		sum(_.value; init=0.)
	end
	@aside total = sum()
	map((val=_ |> ceil |> Int, frac=_ / total))
end

```

From what I’ve seen, earlier “builtin currying” proposals only helped with very simple cases. If a package like `DataPipes.jl` remains needed for anything more complex anyways, there is no big deal to get used to a macro.

> [@pdeffebach](#):
>
> The only gripe I have with `@chain` is that it requires you to know you want to pipe something at the _beginning_ of the expression. In `R` I can do

That’s quite useful indeed, and `DataPipes.jl` neatly supports this usecase _(`Underscores.jl` also do, btw)_. It just fits within builtin julia pipes, so that you can start typing an expression without foreseeing that advanced piping would be needed further down the line: `some_long_table |> @f(filter(isodd(_.day)) |> map(_.value)) |> sum`.

---

_[View the full topic](https://discourse.julialang.org/t/fixing-the-piping-chaining-issue/89654)._
