<?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: Heuristics are easy</title>
	<atom:link href="http://cairnarvon.rotahall.org/2010/03/02/heuristics-are-easy/feed/" rel="self" type="application/rss+xml" />
	<link>http://cairnarvon.rotahall.org/2010/03/02/heuristics-are-easy/</link>
	<description>Unscientific and ultimately destructive.</description>
	<lastBuildDate>Sun, 12 May 2013 14:59:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Cairnarvon</title>
		<link>http://cairnarvon.rotahall.org/2010/03/02/heuristics-are-easy/comment-page-1/#comment-58346</link>
		<dc:creator>Cairnarvon</dc:creator>
		<pubDate>Sun, 01 Jan 2012 20:24:57 +0000</pubDate>
		<guid isPermaLink="false">http://cairnarvon.rotahall.org/?p=1683#comment-58346</guid>
		<description><![CDATA[The second argument of &lt;code&gt;sorted&lt;/code&gt; is a function that takes as its arguments two elements of the list to be sorted, and returns a negative number if the first is smaller than the second (according to some relevant ordering), zero if they&#039;re equal, and a positive number if the first element is greater than the second.
&lt;code&gt;sorted&lt;/code&gt; returns a new list, which is then joined to the tail of the queue (that is, all of the queue except for the first element; which is obtained using a list slice).

Longer way to write this would be:

&lt;blockquote&gt;
&lt;code&gt;def sort_function(element1, element2):
&lt;tt&gt;    &lt;/tt&gt;return h(element1[1]) - h(element2[1])

sorted_new_nodes = sorted(new_nodes, sort_function)
tail_of_queue = queue[1:]
queue = sorted_new_nodes + tail_of_queue&lt;/code&gt;&lt;/blockquote&gt;
Hope that clarifies.]]></description>
		<content:encoded><![CDATA[<p>The second argument of <code>sorted</code> is a function that takes as its arguments two elements of the list to be sorted, and returns a negative number if the first is smaller than the second (according to some relevant ordering), zero if they&#8217;re equal, and a positive number if the first element is greater than the second.<br />
<code>sorted</code> returns a new list, which is then joined to the tail of the queue (that is, all of the queue except for the first element; which is obtained using a list slice).</p>
<p>Longer way to write this would be:</p>
<blockquote><p>
<code>def sort_function(element1, element2):<br />
<tt>    </tt>return h(element1[1]) - h(element2[1])</p>
<p>sorted_new_nodes = sorted(new_nodes, sort_function)<br />
tail_of_queue = queue[1:]<br />
queue = sorted_new_nodes + tail_of_queue</code></p></blockquote>
<p>Hope that clarifies.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AsianBorat</title>
		<link>http://cairnarvon.rotahall.org/2010/03/02/heuristics-are-easy/comment-page-1/#comment-58333</link>
		<dc:creator>AsianBorat</dc:creator>
		<pubDate>Sun, 01 Jan 2012 08:00:10 +0000</pubDate>
		<guid isPermaLink="false">http://cairnarvon.rotahall.org/?p=1683#comment-58333</guid>
		<description><![CDATA[queue = sorted(new_nodes, lambda a, b: h(a[1]) - h(b[1])) + queue[1:]

How in hell does this line work? I read up on lambdas and sorted (I&#039;m unfamiliar with Python), but I can&#039;t make sense of this line.]]></description>
		<content:encoded><![CDATA[<p>queue = sorted(new_nodes, lambda a, b: h(a[1]) &#8211; h(b[1])) + queue[1:]</p>
<p>How in hell does this line work? I read up on lambdas and sorted (I&#8217;m unfamiliar with Python), but I can&#8217;t make sense of this line.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://cairnarvon.rotahall.org/2010/03/02/heuristics-are-easy/comment-page-1/#comment-45471</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 02 Mar 2010 18:49:52 +0000</pubDate>
		<guid isPermaLink="false">http://cairnarvon.rotahall.org/?p=1683#comment-45471</guid>
		<description><![CDATA[Really enjoying these posts. Thanks.]]></description>
		<content:encoded><![CDATA[<p>Really enjoying these posts. Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

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