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 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?
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.
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
.