Re: Default array base index



On Mon, 28 Jan 2008 09:02:51 -0800 (PST), Adam Beneschan wrote:

Also, we always number everything else starting
with "first", "second", etc.; ever seen a baseball game played with
"zero-th base", "first base", and "second base"? ("Who's on zero-
th?" "Yes."
"I mean his name." "Who." "The guy on zero-th." "Who." "The zero-
th baseman." "Who." Just doesn't have the same ring to it.) So it
isn't an "Ada culture" at all---it's the fact that using 1 seems more
natural, and that I get to use a language that gives me a choice,
rather than struggling with a low-level language like C that forces me
into unnatural behaviors like using 0 as the index base.

I think it boils down to the semantic difference between numerals and
ordinals. The problem arises when the same notation is attempted for both.
When 1 denotes an ordinal (the first) then 0 does not exist. There is
nothing before the first. But in the set of natural numbers 0 is the first
number. So 0 = 1. In some other set it could be the second or none. In Ada
the first ordinal used for arrays as sets is A'First, so the first element
is A(A'First), and not necessarily either A(1) or A(0).

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: Understanding the quotient ring nomenclature
    ... element of R, but is another ring element entirely, here represented ... weird to you because we are often using language very specifically, ... say "the polynomials are not rings" which is fundamentally wrong. ... infinite series are reals. ...
    (sci.math)
  • Re: problem with while statements..
    ... I'd expect it to be most frequent in whatever index-base the programmer at hand is least used to. ... Curious but I'm not sure I care who is right, To me, *ordinals* are numbers used to define the *order* of a bunch of things. ... I'm pretty sure that people had multiple rabbit hutches prior to the widespread use of the concept of zero. ... developed the proper habits for a zero-based language, it's every bit as problematic for them to switch to a one-based language as it might have been for them to learn the zero-based language in the first place. ...
    (comp.lang.java.programmer)
  • Re: Understanding the quotient ring nomenclature
    ... I will stand by this language and reinforce the instance below here. ... Suppose a to be an element in the ring A and b to be an element in the ... context or prior agreement, the question becomes meaningless. ... The reason we can add and multiply integers and reals is ...
    (sci.math)
  • Re: Understanding the quotient ring nomenclature
    ... element of R, but is another ring element entirely, here represented ... weird to you because we are often using language very specifically, ... say "the polynomials are not rings" which is fundamentally wrong. ... mean) or you have truly fundamental misunderstandings. ...
    (sci.math)
  • Re: Aleph_Aleph_1
    ...  is the following a theorem of ZFC? ... And 'aleph_' is a term of the language. ... the aleph operation is defined by transfinite ... Moreover, from ZF we prove that for all ordinals j and k, if j in k, ...
    (sci.logic)