From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Corneli Newsgroups: gmane.emacs.help Subject: sorting backwards? Date: Sat, 14 May 2005 22:04:48 -0500 Message-ID: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1116132882 29209 80.91.229.2 (15 May 2005 04:54:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 May 2005 04:54:42 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 15 06:54:41 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DXB9B-000370-1y for geh-help-gnu-emacs@m.gmane.org; Sun, 15 May 2005 06:54:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DXAmX-00031l-Li for geh-help-gnu-emacs@m.gmane.org; Sun, 15 May 2005 00:31:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DX9Ur-0007Bv-VH for help-gnu-emacs@gnu.org; Sat, 14 May 2005 23:08:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DX9Uo-0007AH-Av for help-gnu-emacs@gnu.org; Sat, 14 May 2005 23:08:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DX9Um-00079s-9Z for help-gnu-emacs@gnu.org; Sat, 14 May 2005 23:08:49 -0400 Original-Received: from [146.6.139.124] (helo=dell3.ma.utexas.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DX9YA-000079-1O for help-gnu-emacs@gnu.org; Sat, 14 May 2005 23:12:18 -0400 Original-Received: from lab2.ma.utexas.edu (mail@lab2.ma.utexas.edu [128.83.133.46]) by dell3.ma.utexas.edu (8.11.0.Beta3/8.10.2) with ESMTP id j4F34nx24374; Sat, 14 May 2005 22:04:49 -0500 Original-Received: from jcorneli by lab2.ma.utexas.edu with local (Exim 3.36 #1 (Debian)) id 1DX9Qu-0006K6-00; Sat, 14 May 2005 22:04:48 -0500 Original-To: help-gnu-emacs 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:26617 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26617 I just posted some code on gnu-emacs-sources that includes some sorting. I want to get numbers in decreasing order, but I found that substituting a ">" for a "<" when sorting screws things up. (Lots of contents are omitted.) Since both < and > are symmetrical mathematically, I don't see why this would be. I don't have a great example to hand you right now, but if you grab the fr3q.el code I just posted and substitute, (let (1graphs) (maphash (lambda (key val) (setq 1graphs (cons (cons key val) 1graphs))) fr3q-1graphs) (sort 1graphs (lambda (a b) (> (cdr a) (cdr b)))) ... for (let (1graphs) (maphash (lambda (key val) (setq 1graphs (cons (cons key val) 1graphs))) fr3q-1graphs) (sort 1graphs (lambda (a b) (< (cdr a) (cdr b)))) ... Maybe you can verify that and/or explain why upon running fr3q-print, you see something like: Keys: / 1 4 1 2 1 M-v 1 C-/ 1 E 1 M-c 1 ( 1 ) 1 S 1 A 1 C- 1 M-w 1 C-y 1 insert 1 3 1 C-k 1 > 1 C-M-x 1 instead of (what you expected): Keys: o 114 r 84 i 84 u 83 n 80 74 , 72 a 71 s 59 p 59 e 54 l 49 h 48 g 47 y 43 up 38 down 35 t 33 ' 29 c 28 return 25 backspace 20 f 16 d 15 M-f 15 left 11 m 10 ; 10 q 9 M-q 9 w 7 v 7 . 6 C-e 6 M-b 6 C-s 6 k 5 M-backspace 5 M-< 5 z 4 b 4 M-> 4 C-left 4 C-l 4 1 3 C-v 3 C-right 3 j 2 x 2 (mouse-1 (# 561 (398 . 679) 99227077 nil 561 (66 . 13) nil (-64 . 510) (7 . 13))) 2 5 2 C-g 2 I 2 - 2 C-M-x 2 / 1 4 1 2 1 M-v 1 C-/ 1 E 1 M-c 1 ( 1 ) 1 S 1 A 1 C- 1 M-w 1 C-y 1 insert 1 3 1 C-k 1 > 1 < 1