Re: A model for the natural numbers

From: Anno Siegel (anno4000_at_lublin.zrz.tu-berlin.de)
Date: 07/25/04


Date: 25 Jul 2004 18:41:51 GMT

Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> wrote in sci.math:
> In <cdr82i$ak8$1@mamenchi.zrz.TU-Berlin.DE>, on 07/23/2004
> at 02:41 PM, anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) said:
>
> >It is somewhat unusual to include 0 in the naturals,
>
> No.

It was, for a long time. Times are a-changing, as I have acknowledged
elsewhere in the thread.

> >In fact, indexing from 0 instead of 1 has advantages
> >in some situations, as programmers know.
>
> Yes, as does indexing from 1 and indexing from -5. The fact that some
> languages index from a fixed value does not mean that there is
> anything either convenient or special about that value.

Practically, and historically, the values 0 and 1 *are* special,
as witnessed by the fact that they are the only fixed values ever
considered by main-stream languages. The trend is for newer languages
to have a fixed lower index 0. That is no coincidence.

For a practical example, the formulas that map an N-dimensional
array on a one-dimensional one are simplest when all arrays start
at zero. If there is a nonzero offset, you get to subtract it.

Anno



Relevant Pages

  • [OT] Bla (was: A model for the natural numbers)
    ... > Shmuel Metz wrote ... Times are a-changing, as I have ... > languages to have a fixed lower index 0. ...
    (sci.math)
  • Re: why cannot assign to function call
    ... hypothetical C-like languages, ... sizeof business would still indicate that a pointer was being passed. ... talk about variables of an array type. ... the earlier version of the standard didn't have numbered ...
    (comp.lang.python)
  • Re: should every thing be zero indexed?
    ... Other families of languages count from 1. ... of languages inherited the tendency to count from 0 because of C array ... around a central data point you can define the array indices to precisely ... integer elements. ...
    (comp.programming)
  • Re: arrays vs. vectors
    ... In Scheme it's called the ... in many other languages it's called an array, ... > When a language exists that has an array type and a vector type (e.g. ...
    (comp.lang.scheme)
  • Re: [PHP] Multi lingual pages
    ... W3 org about localization / internationalization, ... message here about supporting multiple languages. ... from 'per lang' files I would suggest using an array as the ...
    (php.general)

Quantcast