<?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: ruby inject and the Mandelbrot set</title>
	<atom:link href="http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/</link>
	<description>making the human scalable</description>
	<lastBuildDate>Tue, 02 Mar 2010 17:04:37 -0800</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Javi Fontan</title>
		<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/comment-page-1/#comment-23451</link>
		<dc:creator>Javi Fontan</dc:creator>
		<pubDate>Wed, 27 May 2009 01:12:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/#comment-23451</guid>
		<description>Simply lovely.

And now for some performance wars I changed the number of iterations from 50 to 1000 and ran it using ruby 1.8.6 (the one that comes with Leopard), ruby 1.9.1p0 (2009-01-30 revision 21907) and MacRuby 0.4:

ruby 1.8.6
real	0m54.405s
user	0m54.209s
sys	0m0.083s

ruby 1.9.1p0
real	0m10.758s
user	0m8.756s
sys	0m0.133s

MacRuby 0.4
real	1m7.342s
user	1m19.255s
sys	0m2.261s</description>
		<content:encoded><![CDATA[<p>Simply lovely.</p>
<p>And now for some performance wars I changed the number of iterations from 50 to 1000 and ran it using ruby 1.8.6 (the one that comes with Leopard), ruby 1.9.1p0 (2009-01-30 revision 21907) and MacRuby 0.4:</p>
<p>ruby 1.8.6<br />
real	0m54.405s<br />
user	0m54.209s<br />
sys	0m0.083s</p>
<p>ruby 1.9.1p0<br />
real	0m10.758s<br />
user	0m8.756s<br />
sys	0m0.133s</p>
<p>MacRuby 0.4<br />
real	1m7.342s<br />
user	1m19.255s<br />
sys	0m2.261s</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Fairchild</title>
		<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/comment-page-1/#comment-23447</link>
		<dc:creator>Michael Fairchild</dc:creator>
		<pubDate>Tue, 26 May 2009 23:02:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/#comment-23447</guid>
		<description>This is awesome.  Mad props.
Here is a screenshot from a run of the code.
http://img.skitch.com/20090526-jdss7n6f8hssmmywnsyiam3ycb.jpg</description>
		<content:encoded><![CDATA[<p>This is awesome.  Mad props.<br />
Here is a screenshot from a run of the code.<br />
<a href="http://img.skitch.com/20090526-jdss7n6f8hssmmywnsyiam3ycb.jpg" rel="nofollow">http://img.skitch.com/20090526-jdss7n6f8hssmmywnsyiam3ycb.jpg</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Pulver</title>
		<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/comment-page-1/#comment-23439</link>
		<dc:creator>Matt Pulver</dc:creator>
		<pubDate>Tue, 26 May 2009 17:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/#comment-23439</guid>
		<description>@Arya: The meaning of the word &quot;appropriate&quot; depends upon what the goals are. The first goal here is to illustrate use of ruby&#039;s inject function. If you can suggest a nearly equally succinct way to write the function

def mandelbrot(a)
  Array.new(50,a).inject(a) { &#124;z,c&#124; z*z+c }
end

which illustrates use of the inject function that doesn&#039;t use a 50-element array of identical values, then I would consider your nit pick &quot;appropriate&quot;.</description>
		<content:encoded><![CDATA[<p>@Arya: The meaning of the word &#8220;appropriate&#8221; depends upon what the goals are. The first goal here is to illustrate use of ruby&#8217;s inject function. If you can suggest a nearly equally succinct way to write the function</p>
<p>def mandelbrot(a)<br />
  Array.new(50,a).inject(a) { |z,c| z*z+c }<br />
end</p>
<p>which illustrates use of the inject function that doesn&#8217;t use a 50-element array of identical values, then I would consider your nit pick &#8220;appropriate&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arya Asemanfar</title>
		<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/comment-page-1/#comment-23435</link>
		<dc:creator>Arya Asemanfar</dc:creator>
		<pubDate>Tue, 26 May 2009 15:51:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/#comment-23435</guid>
		<description>That&#039;s pretty cool output! :)

One nit pick though, it seems your usage of inject isn&#039;t appropriate because you&#039;re creating an array of size 50 just to iterate over something 50 times.

It might be more appropriate to do something like:

&lt;pre&gt;
def mandelbrot(a)
  z = 0
  50.times { z = z * z + a }
  z
end
&lt;/pre&gt;

That way, if you want to do some large number of iterations, you don&#039;t end up creating and destroying huge arrays. But I guess it&#039;s just preference :)</description>
		<content:encoded><![CDATA[<p>That&#8217;s pretty cool output! <img src='http://www.xcombinator.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>One nit pick though, it seems your usage of inject isn&#8217;t appropriate because you&#8217;re creating an array of size 50 just to iterate over something 50 times.</p>
<p>It might be more appropriate to do something like:</p>
<pre>
def mandelbrot(a)
  z = 0
  50.times { z = z * z + a }
  z
end
</pre>
<p>That way, if you want to do some large number of iterations, you don&#8217;t end up creating and destroying huge arrays. But I guess it&#8217;s just preference <img src='http://www.xcombinator.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eimantas</title>
		<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/comment-page-1/#comment-23403</link>
		<dc:creator>Eimantas</dc:creator>
		<pubDate>Mon, 25 May 2009 17:58:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/#comment-23403</guid>
		<description>awsomeness at it&#039;s best! one can expand it to use colors in console ,)</description>
		<content:encoded><![CDATA[<p>awsomeness at it&#8217;s best! one can expand it to use colors in console ,)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Nolan</title>
		<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/comment-page-1/#comment-23398</link>
		<dc:creator>Dave Nolan</dc:creator>
		<pubDate>Mon, 25 May 2009 15:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/#comment-23398</guid>
		<description>That is a thing of beauty. Cheers!</description>
		<content:encoded><![CDATA[<p>That is a thing of beauty. Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ruby inject and category breadcrumbs</title>
		<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/comment-page-1/#comment-7</link>
		<dc:creator>ruby inject and category breadcrumbs</dc:creator>
		<pubDate>Wed, 05 Mar 2008 18:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/#comment-7</guid>
		<description>[...] addition to mapping out the Mandelbrot set, ruby&#8217;s inject method can also be used to easily find and/or create nested categories given a [...]</description>
		<content:encoded><![CDATA[<p>[...] addition to mapping out the Mandelbrot set, ruby&#8217;s inject method can also be used to easily find and/or create nested categories given a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate Murray</title>
		<link>http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/comment-page-1/#comment-4</link>
		<dc:creator>Nate Murray</dc:creator>
		<pubDate>Tue, 26 Feb 2008 17:50:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/#comment-4</guid>
		<description>Fantastic! The code is succinct and the output is beautiful. Raganwald just wrote another interesting article on Ruby inject that could be interesting to everyone (http://weblog.raganwald.com/2008/02/1100inject.html). As our interview last week said, if these types of constructs (map, inject, etc) should be interesting to anyone who is in the business of programming. 

Thanks for the insightful post!</description>
		<content:encoded><![CDATA[<p>Fantastic! The code is succinct and the output is beautiful. Raganwald just wrote another interesting article on Ruby inject that could be interesting to everyone (<a href="http://weblog.raganwald.com/2008/02/1100inject.html)" rel="nofollow">http://weblog.raganwald.com/2008/02/1100inject.html)</a>. As our interview last week said, if these types of constructs (map, inject, etc) should be interesting to anyone who is in the business of programming. </p>
<p>Thanks for the insightful post!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

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