|>instead, the code to the right of
|>operates on the result from the code to the left of it. In practice, what is on the left becomes the argument of the function call(s) that is on the right.
add6(a) = a+6; div4(a) = 4/a;
a = 2; b = add6(a); c = div4(b); println(c) # 0.5 println(div4(add6(a)))
a |> add6 |> div4 |> println
Pipepackage together with the
@pipemacro hoverrides the |> operator allowing you to use functions with multiple arguments (and there you can use the underscore character "
_" as placeholder for the value on the LHS) and multiple functions, e.g.:
addX(a,x) = a+x; divY(a,y) = a/y @pipe a |> addX(_,6) + divY(4,_) |> println # 10.0