From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: New function for subr.el: sort-on Date: Sat, 25 Nov 2017 01:09:18 +0000 Message-ID: <87po87cgg1.fsf@gmail.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1511572223 25373 195.159.176.226 (25 Nov 2017 01:10:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 25 Nov 2017 01:10:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: John Wiegley Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 25 02:10:16 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIOyu-0005V9-UH for ged-emacs-devel@m.gmane.org; Sat, 25 Nov 2017 02:10:09 +0100 Original-Received: from localhost ([::1]:51656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIOz1-0008Ve-LW for ged-emacs-devel@m.gmane.org; Fri, 24 Nov 2017 20:10:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIOyG-0008VU-7a for emacs-devel@gnu.org; Fri, 24 Nov 2017 20:09:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIOyF-0001Gy-Cj for emacs-devel@gnu.org; Fri, 24 Nov 2017 20:09:28 -0500 Original-Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:34573) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eIOyF-0001Ga-4o for emacs-devel@gnu.org; Fri, 24 Nov 2017 20:09:27 -0500 Original-Received: by mail-wm0-x231.google.com with SMTP id y82so21859916wmg.1 for ; Fri, 24 Nov 2017 17:09:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=SuMndhacnDQcX2OxnB6ey3oE3tB3yvCBksz94474rI8=; b=qcD35NDAfll6GO+cV0HVSXSF63w9jW+j6xTne54dPPBxoeUhH0kKkocrQ7LWsFn379 dvea30GIK2xNaVUBBWrRp4yd0VF9svU/WND0CdcslmIoZJBIuoFAtJMKKH/c9k0bLt7H szKNEs2Hh0Y49dLpPeloyVnBk2MYYIJrchDV9R9Hn6jbCzRSNkYnaO6aTKpChVaH1l90 +NWRHzdhexh5WlgZFOcNz7wx8p1SY+OLvcS9fc5WsQ+xyNe/Jy5xwykdVayzI5dC+qmk gPieQciXp8FUrq52+Ot1TbFfATzHwnsl+FiAJlCK1POlwsN/mlp4YpsianYJu/FYbfLB svqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=SuMndhacnDQcX2OxnB6ey3oE3tB3yvCBksz94474rI8=; b=UDGpWwI7XrtDVkBeaK6EgdMNfjv7UDJGl9wd1vgUsKLkbxPyFJ31s3DNi67BaiS480 Cle+5BRDeO5Z0A27zHfz2+UUUZp6LNQjsov1xTBsXtIbbqSJ//ByZJ6iHeSYuTv7vpEi aUTwYdKsowB43nKztD1AMLDlFh4hlzrZ2TCpwsAov87RVKtg5x0uNwZ/l237MhLAhvL0 EdcIMLx4GBKyxQowYYCkRwyCvFryNeI6c/sWrnKbjzrk4SDjBLO7JrIilAYWlGVKm0te 2WJt6jMGM0uhFCBvFo7osAMJtjfplXHmD9iUSuTgko7dflWgZG45wVpsgWmoQkZlchlx /fAQ== X-Gm-Message-State: AJaThX4t0NMW/8lBW32kZvwuUE8AO+KAPD7TotJcTWmITnA9IGZ/n3NH 94RVd1XzJRGwcKvsY7fwh67Wcg== X-Google-Smtp-Source: AGs4zMacetlVW0ohA8Q8xv4vVj88YRQ5G1vCTJbyyV6foaDE8Aiy8L8eD3n2wV6pIIlalv9Bn3uwdA== X-Received: by 10.80.179.248 with SMTP id t53mr41166861edd.267.1511572165070; Fri, 24 Nov 2017 17:09:25 -0800 (PST) Original-Received: from localhost ([2a02:8084:4f41:8c80:9929:5bdb:4629:fab8]) by smtp.gmail.com with ESMTPSA id 30sm16431344edz.42.2017.11.24.17.09.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Nov 2017 17:09:24 -0800 (PST) In-Reply-To: (John Wiegley's message of "Fri, 24 Nov 2017 09:36:43 -0800") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:220447 Archived-At: John Wiegley writes: > (defsubst sort-on (seq predicate accessor) Perhaps the name `sort-by' would be more consistent with the `seq-sort-by' function defined in lisp/emacs-lisp/seq.el? > (mapcar #'cdr (sort (mapcar #'(lambda (x) (cons (funcall accessor x) x)) seq) ^^ Out of curiosity, is there a preference/convention for/against `function'-quoting lambdas in the Emacs source tree? The only reason I avoid it is because it breaks the fontification of `lambda' as a macro. :) > (setq seq (sort* seq #'(lambda (x y) (funcall predicate (car x) (car y))))) ^^^^^ Is this not the same as using plain `sort' here? -- Basil