[ANN] DataPipes.jl 0.3.0

Let me announce another release of DataPipes, v0.3.5 - already registered in General.

The main highlight since the last update is

Pipe broadcast: .|>

Sometimes operations are more natural to write as a map call, sometimes as a broadcast. Making this even more convenient, DataPipes now supports the broadcasted pipe, .|>.

For the regular pipe |>, the __ placeholder gets replaced with the result of the previous step. Likewise, for the .|> broadcasted pipe, __ means a single element of the previous step result.
When this placeholder is not used, DataPipes implicitly appends it to the function arguments, same for |> and .|>.

Some examples:

julia> @p "1, 2, 3, 4" |> eachmatch(r"(\d)") .|> __.captures[1]
4-element Vector{SubString{String}}:
 "1"
 "2"
 "3"
 "4"
julia> @p [[1, 2], [3]] .|> __ .+ 1
2-element Vector{Vector{Int64}}:
 [2, 3]
 [4]
julia> @p 1:10 |> group(_ % 3) .|> map(_ ^ 2)
3-element Dictionaries.Dictionary{Int64, Vector{Int64}}
 1 │ [1, 16, 49, 100]
 2 │ [4, 25, 64]
 0 │ [9, 36, 81]

Especially the last case demonstrates that .|> is convenient for processing nested datasets in a single line. Alternatives, such as nested maps, are more noisy for simple one-liner pipes.

9 Likes