unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: John Wiegley <johnw@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: New function for subr.el: sort-on
Date: Sat, 25 Nov 2017 01:09:18 +0000	[thread overview]
Message-ID: <87po87cgg1.fsf@gmail.com> (raw)
In-Reply-To: <m2h8tjpoic.fsf@newartisans.com> (John Wiegley's message of "Fri,  24 Nov 2017 09:36:43 -0800")

John Wiegley <johnw@gnu.org> 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



      reply	other threads:[~2017-11-25  1:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-24 17:36 New function for subr.el: sort-on John Wiegley
2017-11-25  1:09 ` Basil L. Contovounesios [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87po87cgg1.fsf@gmail.com \
    --to=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    --cc=johnw@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).