<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Why computer scientists count from zero</title>
	<atom:link href="http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/</link>
	<description>The blog of John D. Cook</description>
	<lastBuildDate>Sat, 11 Feb 2012 22:42:11 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Chris</title>
		<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/comment-page-1/#comment-36878</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Fri, 23 Apr 2010 13:15:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/#comment-36878</guid>
		<description>Dijkstra has a nice and very short little paper on this subject: 
http://userweb.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html</description>
		<content:encoded><![CDATA[<p>Dijkstra has a nice and very short little paper on this subject:<br />
<a href="http://userweb.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html" rel="nofollow">http://userweb.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Evans</title>
		<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/comment-page-1/#comment-36830</link>
		<dc:creator>Aaron Evans</dc:creator>
		<pubDate>Thu, 22 Apr 2010 20:34:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/#comment-36830</guid>
		<description>if you treated item 1 as index 1 (and not index 0) you could do lots of cool things like refer to an array with index 0.  Then you could do

for (array++)
... check array type, whether it&#039;s empty, etc.
... then do something with each iteration</description>
		<content:encoded><![CDATA[<p>if you treated item 1 as index 1 (and not index 0) you could do lots of cool things like refer to an array with index 0.  Then you could do</p>
<p>for (array++)<br />
&#8230; check array type, whether it&#8217;s empty, etc.<br />
&#8230; then do something with each iteration</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hello, world! &#171; Ramblings of a Mind</title>
		<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/comment-page-1/#comment-12485</link>
		<dc:creator>Hello, world! &#171; Ramblings of a Mind</dc:creator>
		<pubDate>Tue, 27 Jan 2009 22:10:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/#comment-12485</guid>
		<description>[...] The definition starts out from zero instead of one because computer scientists always start counting from zero. [...]</description>
		<content:encoded><![CDATA[<p>[...] The definition starts out from zero instead of one because computer scientists always start counting from zero. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/comment-page-1/#comment-2051</link>
		<dc:creator>John</dc:creator>
		<pubDate>Mon, 30 Jun 2008 22:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/#comment-2051</guid>
		<description>Mathematicians are fairly consistent with using half-open intervals too. It&#039;s most common to start indexing from 1 in math, but it varies by context. Matrix element subscripts, for example, start from 1, but power series coefficients start from 0.</description>
		<content:encoded><![CDATA[<p>Mathematicians are fairly consistent with using half-open intervals too. It&#8217;s most common to start indexing from 1 in math, but it varies by context. Matrix element subscripts, for example, start from 1, but power series coefficients start from 0.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Carpenter</title>
		<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/comment-page-1/#comment-2046</link>
		<dc:creator>Bob Carpenter</dc:creator>
		<pubDate>Mon, 30 Jun 2008 20:41:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/#comment-2046</guid>
		<description>We computer scientists also describe intervals using half-open notation, starting at the start, but ending one before the end.  This makes loops simple, as in this loop over [0,k), that is, from 0 inclusive to k exclusive:

&lt;code&gt;for (int i = 0; i &lt; k; i++) { }&lt;/code&gt;

We tend to index strings and compute substrings the same way, with &lt;code&gt;&quot;abcde&quot;.substring(0,3)&lt;/code&gt; being the same as &lt;code&gt;&quot;abc&quot;&lt;/code&gt;.   But to keep you on your toes, we sometimes use start+length rather than start+end.

Set theorists do the same thing, implicitly starting from zero (coded as the empty set in logical theories of arithmetic) and indexing summations with &lt;code&gt;&#931;i &lt; k.  Because zero is the smallest natural number they code, they get away without even writing the zero!</description>
		<content:encoded><![CDATA[<p>We computer scientists also describe intervals using half-open notation, starting at the start, but ending one before the end.  This makes loops simple, as in this loop over [0,k), that is, from 0 inclusive to k exclusive:</p>
<p><code>for (int i = 0; i &lt; k; i++) { }</code></p>
<p>We tend to index strings and compute substrings the same way, with <code>"abcde".substring(0,3)</code> being the same as <code>"abc"</code>.   But to keep you on your toes, we sometimes use start+length rather than start+end.</p>
<p>Set theorists do the same thing, implicitly starting from zero (coded as the empty set in logical theories of arithmetic) and indexing summations with <code>&Sigma;i &lt; k.  Because zero is the smallest natural number they code, they get away without even writing the zero!</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Codewiz51</title>
		<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/comment-page-1/#comment-1909</link>
		<dc:creator>Codewiz51</dc:creator>
		<pubDate>Fri, 27 Jun 2008 00:54:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/#comment-1909</guid>
		<description>We don&#039;t count from zero, we index from zero.  The first item, has an index of zero in our little corner of the world. So item one is referred to as item[0]. It was a long time before humans had a concept of zero as a number (around the 4th century BC if my history serves me. I don&#039;t think it was really codified until around 600 AD.)</description>
		<content:encoded><![CDATA[<p>We don&#8217;t count from zero, we index from zero.  The first item, has an index of zero in our little corner of the world. So item one is referred to as item[0]. It was a long time before humans had a concept of zero as a number (around the 4th century BC if my history serves me. I don&#8217;t think it was really codified until around 600 AD.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/comment-page-1/#comment-1875</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 26 Jun 2008 16:01:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/#comment-1875</guid>
		<description>By vascillating I meant inconsistent approaches in the same code base. Imagine this conversation. 

&quot;I wonder whether this index is one-based or zero based.&quot;

&quot;Who wrote that part of the code?&quot;

&quot;Looks like it was Sam.&quot;

&quot;Oh, then it&#039;s probably one-based.&quot;</description>
		<content:encoded><![CDATA[<p>By vascillating I meant inconsistent approaches in the same code base. Imagine this conversation. </p>
<p>&#8220;I wonder whether this index is one-based or zero based.&#8221;</p>
<p>&#8220;Who wrote that part of the code?&#8221;</p>
<p>&#8220;Looks like it was Sam.&#8221;</p>
<p>&#8220;Oh, then it&#8217;s probably one-based.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Venier</title>
		<link>http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/comment-page-1/#comment-1874</link>
		<dc:creator>John Venier</dc:creator>
		<pubDate>Thu, 26 Jun 2008 15:42:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/#comment-1874</guid>
		<description>I think a preprocessor / kludge is really bad, probably worse than vascillating.  Unless that&#039;s what you mean by vascillating.  I really hated the code in Numerical Recipies for C because of the kludges they used in converting their Fortran to C.  Double-plus ungood.

In a kindergarten somewhere a child of a programmer is counting to ten by saying, &quot;Zero, one, two, three, four, five, six, seven, eight, nine.&quot;</description>
		<content:encoded><![CDATA[<p>I think a preprocessor / kludge is really bad, probably worse than vascillating.  Unless that&#8217;s what you mean by vascillating.  I really hated the code in Numerical Recipies for C because of the kludges they used in converting their Fortran to C.  Double-plus ungood.</p>
<p>In a kindergarten somewhere a child of a programmer is counting to ten by saying, &#8220;Zero, one, two, three, four, five, six, seven, eight, nine.&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.640 seconds -->

