A #ComputingHistory question that came up today: what is the origin of | (the vertical stroke) as bitwise OR in PL/I, and thence to the C family of languages?
I haven't been able to trace it further back, and interestingly in logic it was the "Sheffer Stroke", NAND (although Wikipedia claims that Sheffer actually used it for NOR instead?) There does not seem to be a logic or typesetting convention that birthed |.
I don't know enough about early IBM keyboards to know what other characters might be available.
The choice of & for AND instead of ^ -- it's right there! -- is similarly unclear.
=> More informations about this toot | More toots from markgritter@mathstodon.xyz
@markgritter All I know is that early IBM keypunches (026) did not have the | but did have the &. The | came in with the adoption of the ANS and EBCDIC character sets in 1964.
=> More informations about this toot | More toots from AlgoCompSynth@mastodon.social
@markgritter
I’m willing to bet & was chosen because ^ was unavailable in some common character set or configuration and would be mnemonic for “and” but for | meaning or…
Well shit now I’m nerdsniped. I was wondering if maybe it went back to Kleene with his original regex paper, but I just checked and it’s / there.
What’s interesting is that in Thompson’s regex paper, he uses | to mean or and doesn’t explain it, assuming the reader is already familiar.
=> More informations about this toot | More toots from rk@well.com
@markgritter
I don’t think it’s from the Sheffer stroke; NAND doesn’t seem to immediately lend itself to OR.
It’s prolly gonna be something like “we ran out of characters for operators” or something.
At least the APL keyboards had the proper symbols for everything, as God intended.
=> More informations about this toot | More toots from rk@well.com
@markgritter
Actually, I bet it goes back to BNF. Backus used “or” in his metalanguage for syntax, but when Naur et al adapted it for Algol 60, they used | for or. Maybe that’s it?
Now of course, where Naur got the idea is up for grabs.
=> More informations about this toot | More toots from rk@well.com
@rk I found a "PL/I for people who know Fortran" doc which introduces all the new special characters not in Fortran. I didn't realize PL/I used || for concatenation!
From http://www.bitsavers.org/pdf/ibm/360/pli/SC20-1637-3_A_Guide_to_PL_I_for_FORTRAN_Users_May68.pdf
There's gotta be an IBM keyboard to find that has |, &, and ¬ but lacks ^.
=> View attached media | View attached media
=> More informations about this toot | More toots from markgritter@mathstodon.xyz
@rk Like maybe the 1052?
https://sharktastica.co.uk/resources/images/typewriters/ComputerGeek7066_1052.jpg
This looks like about the right set of characters for PL/I, and has no ^ but it does have ¬.
=> More informations about this toot | More toots from markgritter@mathstodon.xyz
@markgritter in regular expressions | has been used for alternation/union since the beginning. Only a small step to use it for OR?
=> More informations about this toot | More toots from drj@typo.social
@drj I'm not sure if that's true! Kleene's 1951 paper is sort of weird (it's all about neural models) but definitely seems to use & and /, not |. https://web.archive.org/web/20201007183213/https://www.rand.org/content/dam/rand/pubs/research_memoranda/2008/RM704.pdf. What is the earliest paper on regular expressions that switched to vertical lines?
@rk pointed out that BNF uses | for alternation so that might be a point along the way for both uses, or the influence could go the other way if there is a regular language tradition post-1951 that started using |.
=> More informations about this toot | More toots from markgritter@mathstodon.xyz
@markgritter @rk thanks, I admit to only doing cursory, wiki-based, research 🙃
=> More informations about this toot | More toots from drj@typo.social This content has been proxied by September (3851b).Proxy Information
text/gemini