Piping operator |> not documented?

Am I going crazy here, or is the pipe operator |> entirely missing from the docs? Seems like it’s something that should be there (with examples) maybe along with a lot of the other operators here Mathematical Operations and Elementary Functions · The Julia Language

7 Likes

I couldn’t find it in the doc either (though it is in the REPL help)

help?> |>
search: |>

  |>(x, f)

  Applies a function to the preceding argument. This allows for easy function
  chaining.

  julia> [1:5;] |> x->x.^2 |> sum |> inv
  0.01818181818181818

There was some discussion to deprecate it in favour of using specific packages but it looks like it was rejected so it probably should be documented. Maybe open an issue?

3 Likes

It’s under “Essentials” in the Library section. Search functionality in the HTML documents is currently rather poor. (I think the Documenter team know this but haven’t yet decided how to replace the JS.)

6 Likes

A search for “chain” (with the quotes) is fairly fruitful. Perhaps a PR to add the words “piping” and “pipe” to the doc strings would be favourable considered…

I think the quotes quell the fuzziness…?

3 Likes

So now I find that there is also the \cdot operator which is also really hidden away. Personally, I think these should be much more discoverable as they will be novel for people coming from some other languages. I’ll go create an issue suggesting both operators are given a bit of space in the docs. Maybe the Functions section would be a natural home.

EDIT: Done. See #27879 for progress.

5 Likes