Rationale for Pipe Order of Operations?

I feel like both blocks should result in the same result of 7.

Pipe1

Pipe2

Is there a reason why the pipe isn’t the last thing processed?

The table of order of operations is in the manual at Mathematical Operations and Elementary Functions · The Julia Language.
Note that |> comes before the comparison operators. So your second version is equivalent to

diff(depths) .> (0 |> sum)

and (0 |> sum) == 0

1 Like

Maybe @kapple is asking why is that a good precedence level for |>

1 Like

Thanks @LeePhillips for the reference.

As @jzr points out, I’m wondering why this order is implemented.

I feel like, I want to do a few things, then pipe the result through.

Your preference makes sense to me. I think the pipe should be the most loosely bound operator. But I suspect there’s a reason for it being where it is that hasn’t occurred to me.

1 Like