<?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 ruby? part two &#8211; blocks and closures</title>
	<atom:link href="http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/</link>
	<description>Where the rising ape meets the falling angel</description>
	<lastBuildDate>Sun, 22 Apr 2012 19:03:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: zynasis</title>
		<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/#comment-131</link>
		<dc:creator>zynasis</dc:creator>
		<pubDate>Fri, 12 Jun 2009 03:11:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.iamnolegend.com/?p=98#comment-131</guid>
		<description>AGH!!! my eyes are bleeding!!

oh wait, thats just ruby code</description>
		<content:encoded><![CDATA[<p>AGH!!! my eyes are bleeding!!</p>
<p>oh wait, thats just ruby code</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ochronus</title>
		<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/#comment-128</link>
		<dc:creator>ochronus</dc:creator>
		<pubDate>Wed, 10 Jun 2009 17:00:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.iamnolegend.com/?p=98#comment-128</guid>
		<description>&lt;a href=&quot;#comment-1449&quot; rel=&quot;nofollow&quot;&gt;@Ethan &lt;/a&gt; 
Thanks for the heads-up, you&#039;re absolutely right. I&#039;ve simplified the example code.</description>
		<content:encoded><![CDATA[<p><a href="#comment-1449" rel="nofollow">@Ethan </a><br />
Thanks for the heads-up, you&#8217;re absolutely right. I&#8217;ve simplified the example code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ethan</title>
		<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/#comment-127</link>
		<dc:creator>Ethan</dc:creator>
		<pubDate>Wed, 10 Jun 2009 14:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.iamnolegend.com/?p=98#comment-127</guid>
		<description>Why are you passing nil to inject? All that does is make &quot;sum&quot; (first parameter) equal nil on the first iteration, requiring you to explicitly check if it&#039;s nil or not in the block&#039;s body. 

This is pointless. You don&#039;t need to pass anything:

x.inject { &#124;a,b&#124; a + b }

The correct time to use inject&#039;s parameter when summing is when you are operating on an array of objects, rather than integers. If you pass 0 it will guarantee that the first parameter to the block begins as an integer and stays that way.

For example, given an array x of objects with the property some_int_property:

x.inject(0) { &#124;a,b&#124; a + b.some_int_property }</description>
		<content:encoded><![CDATA[<p>Why are you passing nil to inject? All that does is make &#8220;sum&#8221; (first parameter) equal nil on the first iteration, requiring you to explicitly check if it&#8217;s nil or not in the block&#8217;s body. </p>
<p>This is pointless. You don&#8217;t need to pass anything:</p>
<p>x.inject { |a,b| a + b }</p>
<p>The correct time to use inject&#8217;s parameter when summing is when you are operating on an array of objects, rather than integers. If you pass 0 it will guarantee that the first parameter to the block begins as an integer and stays that way.</p>
<p>For example, given an array x of objects with the property some_int_property:</p>
<p>x.inject(0) { |a,b| a + b.some_int_property }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: helen</title>
		<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/#comment-126</link>
		<dc:creator>helen</dc:creator>
		<pubDate>Wed, 10 Jun 2009 09:08:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.iamnolegend.com/?p=98#comment-126</guid>
		<description>I surly will try it!</description>
		<content:encoded><![CDATA[<p>I surly will try it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: softmind</title>
		<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/#comment-125</link>
		<dc:creator>softmind</dc:creator>
		<pubDate>Wed, 10 Jun 2009 06:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.iamnolegend.com/?p=98#comment-125</guid>
		<description>&lt;p&gt;Promoting Ruby:- &#8221; Why ruby ? part two - blocks and closures &#8221; &lt;a href=&quot;http://tinyurl.com/m8nsc5&quot; rel=&quot;nofollow&quot;&gt;http://tinyurl.com/m8nsc5&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://twitter.com/softmind/statuses/2100545477&quot; rel=&quot;nofollow&quot;&gt;Twitter&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Promoting Ruby:- &#8221; Why ruby ? part two &#8211; blocks and closures &#8221; <a href="http://tinyurl.com/m8nsc5" rel="nofollow">http://tinyurl.com/m8nsc5</a></p>
<p><i>This comment was originally posted on <a href="http://twitter.com/softmind/statuses/2100545477" rel="nofollow">Twitter</a></i></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: softmind</title>
		<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/#comment-129</link>
		<dc:creator>softmind</dc:creator>
		<pubDate>Wed, 10 Jun 2009 06:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.iamnolegend.com/?p=98#comment-129</guid>
		<description>&lt;p&gt;Promoting Ruby:- &#8221; Why ruby ? part two &#8211; blocks and closures &#8221; &lt;a href=&quot;http://tinyurl.com/m8nsc5&quot; rel=&quot;nofollow&quot;&gt;http://tinyurl.com/m8nsc5&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://twitter.com/softmind/statuses/2100545477&quot; rel=&quot;nofollow&quot;&gt;Twitter&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Promoting Ruby:- &#8221; Why ruby ? part two &#8211; blocks and closures &#8221; <a href="http://tinyurl.com/m8nsc5" rel="nofollow">http://tinyurl.com/m8nsc5</a></p>
<p><i>This comment was originally posted on <a href="http://twitter.com/softmind/statuses/2100545477" rel="nofollow">Twitter</a></i></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ochronus</title>
		<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/#comment-124</link>
		<dc:creator>ochronus</dc:creator>
		<pubDate>Tue, 09 Jun 2009 20:49:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.iamnolegend.com/?p=98#comment-124</guid>
		<description>&lt;p&gt;Why ruby? part two - blocks and closures - &lt;a href=&quot;http://bit.ly/kkBvA&quot; rel=&quot;nofollow&quot;&gt;http://bit.ly/kkBvA&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://twitter.com/ochronus/statuses/2094290557&quot; rel=&quot;nofollow&quot;&gt;Twitter&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Why ruby? part two &#8211; blocks and closures &#8211; <a href="http://bit.ly/kkBvA" rel="nofollow">http://bit.ly/kkBvA</a></p>
<p><i>This comment was originally posted on <a href="http://twitter.com/ochronus/statuses/2094290557" rel="nofollow">Twitter</a></i></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ochronus</title>
		<link>http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/#comment-130</link>
		<dc:creator>ochronus</dc:creator>
		<pubDate>Tue, 09 Jun 2009 20:49:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.iamnolegend.com/?p=98#comment-130</guid>
		<description>&lt;p&gt;Why ruby? part two &#8211; blocks and closures &#8211; &lt;a href=&quot;http://bit.ly/kkBvA&quot; rel=&quot;nofollow&quot;&gt;http://bit.ly/kkBvA&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://twitter.com/ochronus/statuses/2094290557&quot; rel=&quot;nofollow&quot;&gt;Twitter&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Why ruby? part two &#8211; blocks and closures &#8211; <a href="http://bit.ly/kkBvA" rel="nofollow">http://bit.ly/kkBvA</a></p>
<p><i>This comment was originally posted on <a href="http://twitter.com/ochronus/statuses/2094290557" rel="nofollow">Twitter</a></i></p>
]]></content:encoded>
	</item>
</channel>
</rss>

