Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parens to |> docstring #36155

Merged
merged 2 commits into from
Feb 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -901,10 +901,11 @@ widen(x::Type{T}) where {T} = throw(MethodError(widen, (T,)))
|>(x, f)

Applies a function to the preceding argument. This allows for easy function chaining.
When used with anonymous functions, parentheses are typically required around the definition to get the intended chain.

ViralBShah marked this conversation as resolved.
Show resolved Hide resolved
# Examples
```jldoctest
julia> [1:5;] |> (x->x.^2) |> sum |> inv
julia> [1:5;] .|> (x -> x^2) |> sum |> inv
0.01818181818181818
```
"""
Expand Down