Data First Pipeline

As someone, who comes mainly from functional statically typed languages, I stumbled over this article, pointing out some potentially unique approach, and wondered how it would work in Julia.

I have not had many experiences with the pipe here, with the exception that it seems to connect fewer elements than in F#, since not everything here seems to be implemented as a function.

not sure if it’s referencing the same thing, but you may be interested in this experimental branch to add pipefirst/pipelast operators Experiment: Playing with currying, chaining and underscores by c42f · Pull Request #148 · JuliaLang/JuliaSyntax.jl · GitHub

1 Like

What exactly do you mean here? Multiple dispatch, and functions with it, are fundamental to design of Julia and packages.

Julia data processing functions often take the “data last” approach in the terms of that article, as the first argument tends to be a lambda function: think map, filter, etc.
DataPipes.jl is a small macro package that makes bulding pipeline of “data last” functions convenient. Eg, @p tbl |> filter(_.a > 5) |> map(_.b + _.c) .

1 Like

I have never thought about how many details a pipe has to consider, since it always just did its job, and I never questioned it. It always seemed a simple solution, and now I realize that’s probably just true for me, as a user :sweat_smile:

Thanks, that DataPipes.jl looks a lot more like something that I am used to.
I guess there are no plans, to revisit the “normal” pipe, since that would break backwards?

In case you have some time, there have been several very long (and fun) threads on ideas around piping operators: Here is the most recent one, summarizing quite a bit of the discussion.

1 Like

Just found out, that Julia does already have composition: I question if that would be an easy, and particularly more standardized way, and ask myself if that would be sufficient for me.

Let’s see :slight_smile: