<?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: Comparing LOOP and ITERATE</title>
	<atom:link href="http://items.sjbach.com/211/comparing-loop-and-iterate/feed" rel="self" type="application/rss+xml" />
	<link>http://items.sjbach.com/211/comparing-loop-and-iterate</link>
	<description></description>
	<lastBuildDate>Mon, 12 Jul 2010 13:57:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: items.sjbach.com &#187; Extending the ITERATE macro</title>
		<link>http://items.sjbach.com/211/comparing-loop-and-iterate/comment-page-1#comment-23</link>
		<dc:creator>items.sjbach.com &#187; Extending the ITERATE macro</dc:creator>
		<pubDate>Sun, 26 Oct 2008 19:35:39 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=211#comment-23</guid>
		<description>[...] a previous article I gave an overview of ITERATE but punted on showing its best feature, the ability to extend it to support new iteration [...]</description>
		<content:encoded><![CDATA[<p>[...] a previous article I gave an overview of ITERATE but punted on showing its best feature, the ability to extend it to support new iteration [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Bach</title>
		<link>http://items.sjbach.com/211/comparing-loop-and-iterate/comment-page-1#comment-22</link>
		<dc:creator>Stephen Bach</dc:creator>
		<pubDate>Wed, 22 Oct 2008 18:18:22 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=211#comment-22</guid>
		<description>Hagen, happy to help. :-)</description>
		<content:encoded><![CDATA[<p>Hagen, happy to help. <img src='http://items.sjbach.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hagen Ladwig</title>
		<link>http://items.sjbach.com/211/comparing-loop-and-iterate/comment-page-1#comment-21</link>
		<dc:creator>Hagen Ladwig</dc:creator>
		<pubDate>Wed, 22 Oct 2008 14:26:35 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=211#comment-21</guid>
		<description>Thanks for the parallel binding comment. I never use DO. Sometimes I tried and always had to change it to a DO*; I thought I was missing some point and kept trying from time to time, waiting for enlightenment.</description>
		<content:encoded><![CDATA[<p>Thanks for the parallel binding comment. I never use DO. Sometimes I tried and always had to change it to a DO*; I thought I was missing some point and kept trying from time to time, waiting for enlightenment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Bach</title>
		<link>http://items.sjbach.com/211/comparing-loop-and-iterate/comment-page-1#comment-20</link>
		<dc:creator>Stephen Bach</dc:creator>
		<pubDate>Wed, 22 Oct 2008 00:38:16 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=211#comment-20</guid>
		<description>Olivier: past a certain point, I agree.  I would only prefer loop if the whole form could fit comfortably on a single line.

Daniel, re: your second reason, I&#039;d argue that a &lt;code&gt;DOTIMES&lt;/code&gt; loop would be less clear, as that list would probably be collected using the longer push-nreverse idiom:

&lt;pre&gt;
(let (lst)
  (dotimes (i 5)
    (push i lst))
  (nreverse lst))
&lt;/pre&gt;

Otherwise, I agree with you.</description>
		<content:encoded><![CDATA[<p>Olivier: past a certain point, I agree.  I would only prefer loop if the whole form could fit comfortably on a single line.</p>
<p>Daniel, re: your second reason, I&#8217;d argue that a <code>DOTIMES</code> loop would be less clear, as that list would probably be collected using the longer push-nreverse idiom:</p>
<pre>
(let (lst)
  (dotimes (i 5)
    (push i lst))
  (nreverse lst))
</pre>
<p>Otherwise, I agree with you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Radetsky</title>
		<link>http://items.sjbach.com/211/comparing-loop-and-iterate/comment-page-1#comment-19</link>
		<dc:creator>Daniel Radetsky</dc:creator>
		<pubDate>Tue, 21 Oct 2008 21:50:34 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=211#comment-19</guid>
		<description>Stephen: I don&#039;t think your example of the simple loops (I&#039;m not sure they are properly called &quot;List Comprehensions&quot;, but whatever) is a very good one for a number of reasons:

&lt;ol&gt;
&lt;li&gt;I&#039;ve never seen anyone write an iter-loop on one line like that. It&#039;s always written with the accumulator directly below the driver. In this case, the extra parentheses are beside the point: it&#039;s easier (for humans) to parse the code because the what-are-we-iterating-over and the what-are-we-doing parts are separate.&lt;/li&gt;

&lt;li&gt;Comparing simple loops is uninformative. Both of those loops are so simple that you don&#039;t need &lt;code&gt;loop&lt;/code&gt; or &lt;code&gt;iter&lt;/code&gt;. &lt;code&gt;dotimes&lt;/code&gt; is plenty. The only proper test of an iteration construct is whether it can be used to write complicated loops effectively. After all, you don&#039;t need any iteration constructs in scheme, as recursion is fine for relatively simple loops.&lt;/li&gt;
&lt;/ol&gt;

Your point that &quot;clauses may appear arbitrarily deep in the body&quot; is a good reason to prefer iterate for complex loops, but it is only for complex loops that you care about powerful iteration constructs.
</description>
		<content:encoded><![CDATA[<p>Stephen: I don&#8217;t think your example of the simple loops (I&#8217;m not sure they are properly called &#8220;List Comprehensions&#8221;, but whatever) is a very good one for a number of reasons:</p>
<ol>
<li>I&#8217;ve never seen anyone write an iter-loop on one line like that. It&#8217;s always written with the accumulator directly below the driver. In this case, the extra parentheses are beside the point: it&#8217;s easier (for humans) to parse the code because the what-are-we-iterating-over and the what-are-we-doing parts are separate.</li>
<li>Comparing simple loops is uninformative. Both of those loops are so simple that you don&#8217;t need <code>loop</code> or <code>iter</code>. <code>dotimes</code> is plenty. The only proper test of an iteration construct is whether it can be used to write complicated loops effectively. After all, you don&#8217;t need any iteration constructs in scheme, as recursion is fine for relatively simple loops.</li>
</ol>
<p>Your point that &#8220;clauses may appear arbitrarily deep in the body&#8221; is a good reason to prefer iterate for complex loops, but it is only for complex loops that you care about powerful iteration constructs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier Drolet</title>
		<link>http://items.sjbach.com/211/comparing-loop-and-iterate/comment-page-1#comment-18</link>
		<dc:creator>Olivier Drolet</dc:creator>
		<pubDate>Tue, 21 Oct 2008 20:15:44 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=211#comment-18</guid>
		<description>Stephen, I have never found the abundance of parentheses to impede clarity. On the contrary, in the example you give, I find the parens help me see the structure when glancing, and do not detract when I need to read the code attentively. YMMV.</description>
		<content:encoded><![CDATA[<p>Stephen, I have never found the abundance of parentheses to impede clarity. On the contrary, in the example you give, I find the parens help me see the structure when glancing, and do not detract when I need to read the code attentively. YMMV.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Bach</title>
		<link>http://items.sjbach.com/211/comparing-loop-and-iterate/comment-page-1#comment-17</link>
		<dc:creator>Stephen Bach</dc:creator>
		<pubDate>Tue, 21 Oct 2008 17:07:39 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=211#comment-17</guid>
		<description>Certainly a case could be made.  To continue the point, compare these two simple list comprehensions:

&lt;pre&gt;
(loop for i upto 5 collect i)

(iter (for i from 0 to 5) (collect i))
&lt;/pre&gt;

The LOOP example is obviously clearer for lack of parentheses.</description>
		<content:encoded><![CDATA[<p>Certainly a case could be made.  To continue the point, compare these two simple list comprehensions:</p>
<pre>
(loop for i upto 5 collect i)

(iter (for i from 0 to 5) (collect i))
</pre>
<p>The LOOP example is obviously clearer for lack of parentheses.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://items.sjbach.com/211/comparing-loop-and-iterate/comment-page-1#comment-16</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Tue, 21 Oct 2008 16:59:21 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=211#comment-16</guid>
		<description>Arguably, the &quot;does not look like Lisp&quot;-ness of loop is a feature, not a bug.  Issues of style aside, rewriting a standard feature makes me a bit nervous.  The new functionality seems like good stuff, though.</description>
		<content:encoded><![CDATA[<p>Arguably, the &#8220;does not look like Lisp&#8221;-ness of loop is a feature, not a bug.  Issues of style aside, rewriting a standard feature makes me a bit nervous.  The new functionality seems like good stuff, though.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 4/14 queries in 0.070 seconds using disk

Served from: items.sjbach.com @ 2010-07-29 13:50:17 -->