On Tue, Dec 24, 2013 at 6:09 AM, R.E. Boss <[email protected]> wrote:
>> From: [email protected] [mailto:programming-
>> [email protected]] On Behalf Of Raul Miller
>> Subject: Re: [Jprogramming] A little question
>>
>> I'd like to note an oddity about numbers and their words:
>>
>> 0 First
>> 1 Second
>> 2 Third
>> 3 Fourth
> (...)
>
> Well, as you know, the oddity relates to the strange way of numbering used
> in programming (and J).

And in English (as well as other languages).

As near as I can tell, the distinction between cardinal and ordinal
numbers dates back to the 1800s - well before the implementation of J.
So if there's a strangeness here, I think it's a bit larger than
simply being about "programming".

> It's as odd as teaching children to count 1,2,... and then when they start
> programming, we tell them: no it should be 0,1,2,...

I think most people are capable of doing both, and that's probably a good thing.

In fact, you cannot teach a child about a number like 1, or 0, until
after someone has taught them about numbers like 2 and 3. One issue
here is generalization - to teach about generalities you need many
examples. But, also, to teach about counting you need to also convey
the idea of grouping multiple things in of the "same kind".

> (Comparable with teaching little children to talk and when they do, tell
> them to shut up.)

As I understand it, two year olds typically go through a phase where
they express the concept "no" rather a lot. I imagine this is a
consequence of the massive acceptance (and frequent joy) of one year
olds and parental efforts to keep them safe. Still, if this kind of
thing distresses you, you can do what I do and try to avoid
socializing with such people.

> I have never read any good reason why programmers should count starting by
> 0.

APL allowed the programmer to start counting at zero or one. This
meant, in contexts where programmers worked together, that the
programmer either (a) had to write code in a fashion which worked for
either starting point, or (b) specify which to use in every context
where it mattered.

An advantage of 0 is that it's an additive identity. Also, binomials
use the exponents 0, 1, 2 (and polynomials are a frequently used
mathematical concept).

> And one of the good reasons _not_ to do that in J particular, is that
> counting from the last one is done by _1,  _2, ...

This negative indexing issue is a bit quirky. I sometimes think that
the whole concept of an implicit index error was a mistake, and that
errors like that should need to be imposed explicitly rather than
implicitly.

> I don't want to reopen this old discussion, but it is peculiar you call it
> an oddity.

Too late... ;)

> R.E. Boss
>
> (Add your info to http://www.jsoftware.com/jwiki/Community/Demographics )

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to