From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tyler Smith Newsgroups: gmane.emacs.help Subject: Re: random predicate function Date: Mon, 13 Dec 2010 14:05:06 -0500 Message-ID: <87fwu1jxy5.fsf@guruji.demimonde> References: <87mxo9r8xg.fsf@kuiper.lan.informatimago.com> <87y67tplgk.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1292267168 1283 80.91.229.12 (13 Dec 2010 19:06:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Dec 2010 19:06:08 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 13 20:06:04 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PSDim-0004tZ-Be for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Dec 2010 20:06:04 +0100 Original-Received: from localhost ([127.0.0.1]:58550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSDil-0001wl-OH for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Dec 2010 14:06:03 -0500 Original-Received: from [140.186.70.92] (port=41450 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSDi8-0001v1-7z for help-gnu-emacs@gnu.org; Mon, 13 Dec 2010 14:05:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PSDi6-0002tm-Tk for help-gnu-emacs@gnu.org; Mon, 13 Dec 2010 14:05:24 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:55646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PSDi6-0002ta-O1 for help-gnu-emacs@gnu.org; Mon, 13 Dec 2010 14:05:22 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PSDi2-0004Ux-1W for help-gnu-emacs@gnu.org; Mon, 13 Dec 2010 20:05:18 +0100 Original-Received: from 157.89.133.51 ([157.89.133.51]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Dec 2010 20:05:18 +0100 Original-Received: from tyler.smith by 157.89.133.51 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Dec 2010 20:05:18 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 157.89.133.51 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:T0q2S6/1YYFrA3JEPqLFFPHPsuM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77463 Archived-At: "Pascal J. Bourguignon" writes: > Tyler Smith writes: > >> "Pascal J. Bourguignon" writes: >> >>> >>> You shoud not use sort to randomize, because it's suboptimal >>> [ O(n*log(n)) at best instead of O(n) ]. >>> >>> And foremost, you should not use a predicate that is not a total order >>> because this usually gives invalid results. >> >> I don't know what a 'total order' means. Is the result of the predicate >> invalid or the actual sorting? > > http://en.wikipedia.org/wiki/Total_order > > Actually, it should even be a strict total order, that is, it must be a < > operator, not a <= operator. > > > If you have cycles such as: a < b < a > then some sort algorithms may not terminate. > When sorting lists, some algorithms could truncate the result. Ah, thanks. Makes perfect sense now that I think about it. Tyler