<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Where&#039;s Walden? &#187; sorting</title>
	<atom:link href="http://whereswalden.com/tag/sorting/feed/" rel="self" type="application/rss+xml" />
	<link>http://whereswalden.com</link>
	<description>Mozilla, politics, economics, law, backpacking, cycling, and other random desiderata</description>
	<lastBuildDate>Thu, 03 May 2012 09:13:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>ECMA-262 quote of the day</title>
		<link>http://whereswalden.com/2010/02/28/ecma-262-quote-of-the-day/</link>
		<comments>http://whereswalden.com/2010/02/28/ecma-262-quote-of-the-day/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 05:47:31 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[ecma-262]]></category>
		<category><![CDATA[ecmascript]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://whereswalden.com/?p=1420</guid>
		<description><![CDATA[If comparefn is not undefined and is not a consistent comparison function for the elements of this array (see below), the behaviour of sort is implementation-defined. [...] A function comparefn is a consistent comparison function for a set of values S if all of the requirements below are met for all values a, b, and [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
<p>If <var>comparefn</var> is not <code>undefined</code> and is not a consistent comparison function for the elements of this array (see below), the behaviour of <code>sort</code> is implementation-defined.</p>
<p>[...]</p>
<p>A function <var>comparefn</var> is a consistent comparison function for a set of values <var>S</var> if all of the requirements below are met for all values <var>a</var>, <var>b</var>, and <var>c</var> (possibly the same value) in the set <var>S</var>: The notation <var>a</var> &lt;<sub>CF</sub> <var>b</var> means <var>comparefn</var>(<var>a</var>,<var>b</var>) &lt; 0; <var>a</var> =<sub>CF</sub> <var>b</var> means <var>comparefn</var>(<var>a</var>,<var>b</var>) = 0 (of either sign); and a &gt;<sub>CF</sub> <var>b</var> means <var>comparefn</var>(<var>a</var>,<var>b</var>) &gt; 0.</p>
<ul>
<li>Calling <var>comparefn</var>(<var>a</var>,<var>b</var>) always returns the same value <var>v</var> when given a specific pair of values <var>a</var> and <var>b</var> as its two arguments. Furthermore, Type(<var>v</var>) is Number, and <var>v</var> is not <code>NaN</code>. Note that this implies that exactly one of <var>a</var> &lt;<sub>CF</sub> <var>b</var>, <var>a</var> =<sub>CF</sub> <var>b</var>, and <var>a</var> &gt;<sub>CF</sub> <var>b</var> will be true for a given pair of <var>a</var> and <var>b</var>.</li>
<li>Calling <var>comparefn</var>(<var>a</var>,<var>b</var>) does not modify the <code>this</code> object.</li>
<li><var>a</var> =<sub>CF</sub> <var>a</var> (reflexivity)</li>
<li>If <var>a</var> =<sub>CF</sub> <var>b</var>, then <var>b</var> =<sub>CF</sub> <var>a</var> (symmetry)
<li>If <var>a</var> =<sub>CF</sub> <var>b</var> and <var>b</var> =<sub>CF</sub> <var>c</var>, then <var>a</var> =<sub>CF</sub> c (transitivity of =<sub>CF</sub>)</li>
<li>If <var>a</var> &lt;<sub>CF</sub> <var>b</var> and <var>b</var> &lt;<sub>CF</sub> <var>c</var>, then <var>a</var> &lt;<sub>CF</sub> <var>c</var> (transitivity of &lt;<sub>CF</sub>)</li>
<li>If <var>a</var> &gt;<sub>CF</sub> <var>b</var> and <var>b</var> &gt;<sub>CF</sub> <var>c</var>, then <var>a</var> &gt;<sub>CF</sub> <var>c</var> (transitivity of &gt;<sub>CF</sub>)</li>
</ul>
</blockquote>
<div class="attribution"><a href="http://www.mozilla.org/js/language/E262-3.pdf">ECMA-262 3rd edition</a> or <a href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf">ECMA-262 5th edition</a>, 15.4.4.11 Array.prototype.sort (comparefn)</div>
]]></content:encoded>
			<wfw:commentRss>http://whereswalden.com/2010/02/28/ecma-262-quote-of-the-day/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

