I am trying to find which language used the
|> operator first.
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 community
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.
|> 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.
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.