# use strict; use warnings; - Page 2

•  Subject
• Author
• Posted on

## Re: use strict; use warnings;

On 25/02/14 12:00, \$Bill wrote:

What fun.  Does that mean we have, for the first time in history, a need
for the cardinal "oneth"?  The first element is the zeroth; the second
is the oneth.

--

Henry Law            Manchester, England

## Re: use strict; use warnings;

On 2/25/2014 05:02, Henry Law wrote:

Yeah, but twoth sounds funny and I have no idea how to say twelftheth. :)

## Re: use strict; use warnings;

Only by those people, who also celebrated the start of the third
millenium at the end of 1999.

jue

## Re: use strict; use warnings;

No, that's the opposite problem: the Gregorian calendar is 1-indexed.

Ben

## Re: use strict; use warnings;

The Gregorian calender isn't indexed at all because time is not a
random-access sequence. But it is a nice example to illustrate the
differnce: 1AD is the year were Christ turned 1. That's the first year
after his birth. The first millenium ended with with 1000th year after
his birth, hence, the first year of the 2nd millenium was
1001. Ultimatively, the sequence of 'year numbers' comes into being as
years are being counted: The number for each new years is 'number of
years we have seen so far + 1'. There was never a year with 'number 0'
because 0 was the state 'no years seen so far'. This basic model works
the same of any (ordered) sequence of things.

OTOH, 'array indexing' is a surjective function F:X -> Y which maps
'some set of numbers' to 'some set of elements'. Depending on the
programming language which is being used, there may be some additional
restrictions placed on X, eg, 'the smallest element in X is always 0'
for C or 'the smallest element in X is always \$[' for traditional Perl
or 'X may be any subset of the set of integers' for Pascal (and even
more). But regardless of that, there's always a 'first element' which is
the one corresponding with the smallest element of X for some specific
function.

I completely believe that some people refer to 'the zeroth element' if
array indexing happens to be 0-based that the same people will happily
call the first element of an array whose smallest index is -43 the 'minus
43th element'. I've encountered similar logic in a NIC-driver some years
ago where the RX DMA-ring was indexed by an index and the TX ring by an
outdex, ie "Why would I care about anything except my current,
myopic perspective?". But that's not a useful attitude for either
communication of higher-order abstractions.

## Re: use strict; use warnings;

Even within measurement of time, not everything is idiotically one-based,
luckily. The time after 23:59 is 00:00 (though twelve-hour time hides zero by
calling it twelve).  The first minute of every hour is 00, with seconds that go
from 0 to 59.

That should be "minus forty-THIRD element", damn it! It is a perfectly grammatical ordinal, with a clear meaning.

Zeroth is a word, appearing in dictionaries and everything:

http://www.merriam-webster.com/dictionary/zeroth

The nut on a guiar is also the "zeroth fret" (and some instruments actually
have such a fret).  Wikipedia has a page on it, calling it the "zero fret".

"zeroth" does not entail a whimsical reinterpretation of a word fragment like
"outdex".

## Re: use strict; use warnings;

Yet you refer to that as 'first minute', not 'zeroth minute'. That's
consistent with the idea that it is the first new minute observed after
hh:59, ie, something observable is being counted here.

## Re: use strict; use warnings;

[...]

[...]

This is an exaggeration. It may consist of the members of any interval
which is a subset of the set of integers (or however this can be
described).

## Re: use strict; use warnings;

Of course it is. If I open my diary at the page for 'June 2014' I am
accessing a representation of a particular period of time using an
index.

No, there was never a year 0 because the Venemous Bede was working with
a number system which didn't have a zero. Any sensible modern calendar
does include a year or time 0 (usually 1 BC in year-based systems; other
systems like TAI count seconds rather than years and have an
arbitrarily-chosen 'time 0').

Indeed. Exactly as year numbering is a function from the nonzero
integers to a set of periods of time.

Ben

## Re: use strict; use warnings;

You are accessing 'your diary' according to some arbitrary indexing
scheme someone invented. Ergo, your diary is indexed. That doesn't mean
anything else is.

The likely reason why this numbering system didn't have zero was that
nobody saw any use for it. Considering this, it seems unlikely that the
it. But both your statement and my statement are "conjectural history",
ie speculations about what could have happened in the past instead of
what did happen.

That's your misinterpretation of it. As explained above, 'time 0' really
means 'no time passed so far'.

Loosely related: There isn't really a 'minute 0' on the clock, that's
minute sixty of the past hour, after which the 'minute counter' wraps
around to zero because the arithmetic is performed in the mod 60
remainder ring.

I hereby proclaim a much more sensible system of counting that 1st, 2nd, 3rd,
..., one I call Kelvinism. It goes like this -273,15th, -272.15th,
-271.15th ... Not only does this get rid of this confusing array of
context-depenendent suffixes but it is firmly grounded in laws of
nature!.

## Re: use strict; use warnings;

No. ISO 8601 years number AD 1 as +1, 1 BC as +0, and 2 BC as -1. If it
was counting years before or after some point 1 BC would be -1.

There is no 60 in the mod 60 remainder ring. 60 % 60 = 0.

No, it's grounded in the rather arbitrary choice of the freezing point
of water as the basis of the Celsius scale.

Ben

## Re: use strict; use warnings;

For systems which measure passing time, 'time 0' means "we start to
measure now", ie, the POSIX timestamp 1 represents first second which
passed since the epoch. You're correct about ISO8601 'year numbers' but
this is a convention which has very likely been designed for 'ease of
processing' on computers.

... which is why the minute counter of a digital clock wraps to 0 after the
60th minute of an hour has passed ...

There's no Kelvinism but Kelvinism and the dirty heretics who speak of
'Celsian Kelvinism' in order to justify sticking to their
devil-inspired, pagan superstitions will be arianised in due time!

(I was actually envisioning the nice possibility of a theological
schism which is just as pointless, if not more, than the idea itself
here, as further illustration of the absurdity of the concept).

## Re: use strict; use warnings;

says...

Wow, this discussion has gotten really far afield.  Here is my opinion (which I am sure
everyone has been anxiously waiting for...).  When you talk about array locations like:

Arr[50]

people usually call that "location 50" or "Arr 50".  No one would call that location 51, nor
would they refer to location 0 (Arr[0]) as location 1.  So its preferable not to call
location 0, the first location or location 50, the 51st location.  Which is why I like the
idea of calling location 0, the zeroth location.

John Black

## Re: use strict; use warnings;

[...]

A 'so' doesn't make a conclusion.

## Re: use strict; use warnings;

I would call that Arr-ea 51. :)

## Re: use strict; use warnings;

Something more related to Perl: While the tieing mechanism is not really
suited to that because array handling has assumptions about valid
indices baked in, it is nevertheless possible to create 'a Perl array'
which has no location 0:

----
package OffArray;

use Tie::Array;

our @ISA = qw(Tie::Array);

sub TIEARRAY
{
my (\$class, \$ofs) = @_;

return bless({
ofs => \$ofs,
ary => []}, \$class);
}

sub FETCH
{
my (\$self, \$ndx) = @_;

\$ndx -= \$self->;
die("index error") if \$ndx < 0;

return \$self->[\$ndx];
}

sub FETCHSIZE
{
return scalar(@});
}

sub STORE
{
my (\$self, \$ndx, \$v) = @_;

\$ndx -= \$self->;
die("index error") if \$ndx < 0;

return \$self->[\$ndx] = \$v;
}

sub STORESIZE
{
my (\$self, \$count) = @_;
\$#} = \$count + 1;
}

sub EXISTS
{
my (\$self, \$ndx) = @_;

\$ndx -= \$self->;
return \$ndx >= 0 && \$ndx < \$self->FETCHSIZE();
}

sub PUSH
{
my (\$self, @v) = @_;
push(@}, @v);
}

sub SHIFT
{
my \$self = \$_[0];
return shift(@});
}

package main;

my @a;

tie(@a, 'OffArray', 16);

push(@a, \$_) for 0 .. 10;
\$a[55] = 45;

print("\$a[\$_]\n") for 16 .. 16 + \$#a;

my \$count;
while (@a) {
printf("element %u\t%s\n", ++\$count, shift(@a));
}
----

... but its contents can still be treated as an ordered sequence of
items and numbers representing this ordering can be assigned to them by
counting items as they appear in the sequence. This is a property the @a
array used above and ordinary Perl arrays have in common. Consequently,
it makes sense to refer to 'the first element' of an array in either
case (and it makes sense to refer to this as 'the first element' because
a count '0 elements' means 'no elements'). Especially considering that
'things which can be regarded as ordered sequence' exist outside of Perl
and they all have 'a first element', even despite the indexing scheme
used for random access may be radically different.

## Re: use strict; use warnings;

says...

Its location 50, so its also the 50th location.  Why make it confusing?

John Black

## Re: use strict; use warnings;

I suggest that you ask a few people without 'computing background' how
many 'locations' they expect to be in front of "the 50th location" and
then reconsider your idea of what is and isn't confusing ...

## Re: use strict; use warnings;

On Fri, 28 Feb 2014 21:54:24 +0000, Rainer Weikusat

I wonder why programmers make so many off by one errors. But maybe it's
just bad programmers who have little aptitude for the job.

## Re: use strict; use warnings;

says...

Why would it matter what people who don't have a computing background would think about a
computer programming issue, namely array indexing?  Everyone in computers knows that
computers start counting at 0 whereas most people if you asked them to count to 10 would say
1, 2, 3, ...

John Black