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

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): 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 __:

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

2 Likes