Lets you abuse |>
and may make you |>
addict.
With @>
macro, you no longer need to write the boring val |> x -> λ(x, val2)
- compatible with usual
|>
operations
julia> λ(val) == val |> λ == @> val |> λ
- given function call, injects chained value into the first argument (no need to write
val |> x -> λ(x, val2)
)
julia> val |> x -> λ(x) == @> val |> λ()
julia> val |> x -> λ(x, val2) == @> val |> λ(val2)
julia> val |> x -> λ(x, val2) |> x -> λ2(x, val3) == @> val |> λ(val2) |> λ2(val3)
- using tuple, the argument position can be specified
julia> val |> x -> λ(x) == @> val |> (1, λ())
julia> val |> x -> λ(val2, x) == @> val |> (2, λ(val2))
julia> val |> x -> λ(val2, x) |> x -> λ2(x, val3) == @> val |> (2, λ(val2)) |> λ2(val3)
- keyword argument should be specified with symbol
julia> val |> x -> λ(val2; keyword = x) == @> val |> (:keyword, λ(val2))
julia> val |> x -> λ(val2; keyword = x) |> x -> λ2(val3; keyword2 = x) == @> val |> (:keyword, λ(val2)) |> (:keyword2, λ2(val3))
- dot-fusing is fully supported
julia> (ary .|> string .|> x -> λ(x, val)) == @> ary .|> string .|> λ(val)
With @>>
macro, you no longer need even |>
operators themselves.
Equivalent to the examples of
@>
julia> λ(val) == val |> λ == @>> val λ
julia> val |> x -> λ(x) == @>> val λ()
julia> val |> x -> λ(x, val2) == @>> val λ(val2)
julia> val |> x -> λ(x, val2) |> x -> λ2(x, val3) == @>> val λ(val2) λ2(val3)
julia> val |> x -> λ(x) == @>> val (1, λ())
julia> val |> x -> λ(val2, x) == @>> val (2, λ(val2))
julia> val |> x -> λ(val2, x) |> x -> λ2(x, val3) == @>> val (2, λ(val2)) λ2(val3)
julia> val |> x -> λ(val2; keyword = x) == @>> val (:keyword, λ(val2))
julia> val |> x -> λ(val2; keyword = x) |> x -> λ2(val3; keyword2 = x) == @>> val (:keyword, λ(val2)) (:keyword2, λ2(val3))
With @.>>
macro, all the implicit |>
operations are dot-fused.
Equivalent to the last example of
@>
julia> (ary .|> string .|> x -> λ(val, x)) == @.>> ary string (2, λ(val))
- support
.|>
fusing - update documents
- KADOWAKI, Shuhei - Undergraduate@Kyoto Univ. - aviatesk