comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: What is the name of the | symbol?
Date: Fri, 25 Mar 2022 22:03:08 +0200	[thread overview]
Message-ID: <ja6lftFlq3aU1@mid.individual.net> (raw)
In-Reply-To: <8c89d912-0672-4e86-b4f3-7893ef0e7183n@googlegroups.com>

On 2022-03-25 21:16, Matt Jaffe wrote:
> In using it in a named association array aggregate, its semantics are
> "and" --- e.g., some_1D_array := (1 | 3 | 7 => 5, others => 10) sets
> elements 1 and 3 and 7 to the value 5. In a case statement, its
> semantics are "or" --- e.g. when 1 | 3 | 7 => ... any of the values
> 1or 3, or 7 for the case expression will select the ... code for
> execution.


That is a quirk of natural language, where "and" and "or" are used in 
non-mathematical ways. You could as well describe the aggregate as 
saying "if the index is 1 or 3 or 7, the element is 5", and you could 
describe the case statement as saying "this when-branch is executed when 
the case selector is 1 and 3 and 7".

As '|' is used in some logical formalisms for disjunction ("or"), and in 
syntactical notation (BNF) to separate alternatives, I tend to read it 
as "or".


> Is there a single name for that symbol (the | ) that seems
> to have different semantics depending on context?


For the name, see https://en.wikipedia.org/wiki/Vertical_bar, where 
indeed "vertical bar" seems favoured. However, I'm pretty sure that I 
have seen "solidus" used, too, but Wikipedia says that is a synonym for 
"slash" (/). Wiktionary does not recognize "solidus" as a term for any 
punctuation mark.

  reply	other threads:[~2022-03-25 20:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 19:16 What is the name of the | symbol? Matt Jaffe
2022-03-25 20:03 ` Niklas Holsti [this message]
2022-03-26  4:24   ` Paul Rubin
  -- strict thread matches above, loose matches on Subject: below --
2022-03-25 19:04 Matt Jaffe
2022-03-25 19:23 ` Ben Bacarisse
2022-03-25 22:21 ` Jeffrey R.Carter
2022-03-25 23:24   ` Chris Townley
2022-03-26  0:58     ` Luke A. Guest
2022-03-26  2:01       ` Chris Townley
2022-03-27  0:38       ` Stephen Leake
2022-03-27 19:01         ` Matt Jaffe
2022-03-27 18:57     ` Matt Jaffe
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox