I am trying to find which language used the |>
operator first.
It's being discussed for use in R, and it's been in OCaml for some years.
Did it originate in OCaml? If not, what are its earliest origins and use?
Retrocomputing Stack Exchange is a question and answer site for vintage-computer hobbyists interested in restoring, preserving, and using the classic computer and gaming systems of yesteryear. It only takes a minute to sign up.
Sign up to join this communityI am trying to find which language used the |>
operator first.
It's being discussed for use in R, and it's been in OCaml for some years.
Did it originate in OCaml? If not, what are its earliest origins and use?
Douglas McIlroy wanted to introduce pipes already at the beginning of Multics project in 1964:
We should have some ways of connecting programs like garden hose -- screw in another segment when it becomes necessary to massage[sic?] data in another way.
But at least according to Wikipedia, they were implemented in Unix first.
The |>
in OCAML and similar operators for point-free (i.e., not using variables, instead composing functions by pipes and other means) programming in other functional (and increasingly, non-functional) languages go back at least to the seminal article Can programming be liberated from the von Neumann style? by John Backus (you may have heard of Backus-Naur-Form or BNF) from 1978.
If the question is meant more as "why was specifically |>
chosen", it's important to keep in mind that in OCAML, infix operators have to start with certain symbols, and the precedence of the operator is determined by the initial symbols (see e.g. here).
That's why the choice of operators in OCAML is very different from, e.g., Haskell, where there is a whole zoo of left and right application and composition operators, for pure functions, monads, categories, and other structures.
Even though the operation itself is the same.
|>
enables is relatively modern - older functional languages may allow point-free style, but the flow of data is usually right to left, as in standard mathematical function notation (the compose operator is usually f . g
meaning "do g
then perform f
on the result; |>
does it the other way around).
|
and not about the concept, then I guess the symbol |
originates with Unix (and that was probably an influence to choose |>
in OCAML).
[sic?]
but if anyone is confused massage in this case is synonym for transform
vbar is used for a number of different uses, some keyboards have two variants of it ¦ and ̄
In IBM languages like APL, it is used for logical or (true if either or both). IBM were dissenters against a common ASCII code for this reason.
In written maths, | can also mean 'divides', so 5 | 15 means that five goes into 15 an integer number of times.
In the BNL markup form | gives a range of equal options, in 'radio-button' style (exclusive or), so answer = yes | no .
in REXX (1980s), it comes to mean logical or singularly, or concatinate double.
You will probably find it goes back as far as the character used to divide tables, ie a vertical rule in a set of type. This is why it's in CP 437.
|>
character sequence, not about every single use of a vertical line character.
Dec 17, 2020 at 18:29
|>
specifically. There has been some discussion about where such questions ought to reside on meta