Skip to content
Prev 393521 / 398503 Next

Pipe operator

The simplest and best answer is "fashion".
In FSharp,
val it: ('a -> ('a -> 'b) -> 'b)
The ability to turn f x y into y |> f x
makes perfect sense in a programming language
where Currying (representing a function of n
arguments as a function of 1 argument that
returns a function of n-1 arguments, similarly
represented) is a way of life.  It can result
in code that is more readable.  And it is
pretty much unavoidable:
let x |> f = f x
is definable in the language.

In programming languages like Erlang and R,
where Currying is *not* a way of life, the
matter is otherwise.

Really, it's all about whether you talk like Luke
or like Yoda talk, it's not about what you say or
efficiency or anything but perceived readability.
On Wed, 4 Jan 2023 at 05:49, Sorkin, John <jsorkin at som.umaryland.edu> wrote:

            

  
  
Message-ID: <CABcYAdKCwViTa2+kdw-rOcXLWCtx_iydo4P9jyfH4OMdFB-XEQ@mail.gmail.com>
In-Reply-To: <MW4PR03MB63630F75F8C75E3448161E00E2F49@MW4PR03MB6363.namprd03.prod.outlook.com>