🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #5240

Re: The Joy of Zero-based Arrays

#5240
From: Eric S. Raymond
Date: Wed, 09 Mar 1988 13:18
61 lines
2905 bytes
In article <213@sdti.UUCP> Prescott K. Turner, Jr. writes:
>And in Dijkstra's letter in the June 1987 CACM, he numbers his points and
>his references starting with 0.  I find this annoying and wrong-headed.

I agree that it's usually appropriate to have lists for humans start with 1,
and that Dijkstra was being a tad precious (this sort of behavior is an every
once in a while requirement for continued perks and status in the academic
bondage-and-discipline school of language design, doncha know).

However: there is one sort of list-for-humans where zero-basing is appropriate,
in my opinion -- a list that refers to itself. Consider the following examples:

------------------------------------------------------------------------------
This distribution package contains 3 files:

	0. This READ.ME

	1. t&a.txt -- phone numbers and vital statistics of the Dallas
	   Cowboys' cheerleading squad.

	2. hunk.txt -- phone numbers and vital statistics of the Dallas
	   Cowboys.
------------------------------------------------------------------------------

or

------------------------------------------------------------------------------
To install the superduper thingy metacompiler, do the following:

	0. Read this file carefully.

	1. Insert a peanut butter sandwich in your drive slot.

	2. Wrap a maypole with the distribution tape.

------------------------------------------------------------------------------

Also, sometimes a list of instructions will start with one that has sort of
a background prep or general-precondition character, as opposed to the
remainder which are specific well-defined actions. For example:

------------------------------------------------------------------------------
Instructions for going over Niagara Falls in a barrel:

	0. Make sure you really want to do this.

	1. Procure a barrel.

	2. Pad the insides generously.

		(etc.)
------------------------------------------------------------------------------

In these particular sorts of cases, I find zero-indexing a useful cue.

{Mild apologies for the silliness of the examples. I just stumbled out of bed
and haven't showered or breakfasted yet. And BTW I am *not* a football fan...}
-- 
      Eric S. Raymond                  (the mad mastermind of TMN-Netnews)
      UUCP:  {{seismo,ihnp4,rutgers}!cbmvax,sdcrdcf!burdvax,vu-vlsi}!snark!eric
      Post:  22 South Warren Avenue, Malvern, PA 19355    Phone: (215)-296-5718
Technical Details
Message-ID: <22354978:1fae@snark.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!cbmvax!snark!eric
References: <1012@PT.CS.CMU.EDU> <17419@think.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!cbmvax!snark!eric
From: eric@snark.UUCP (Eric S. Raymond)
Newsgroups: comp.lang.misc
Subject: Re: The Joy of Zero-based Arrays
Message-ID: <22354978:1fae@snark.UUCP>
Date: 9 Mar 88 13:18:36 GMT
References: <1012@PT.CS.CMU.EDU> <17419@think.UUCP>
Organization: Thyrsus Enterprises, Malvern PA 19355
Lines: 61
Summary: There *is* one good use for zero-basing in lists for humans