[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New function for subr.el: sort-on
From: |
Basil L. Contovounesios |
Subject: |
Re: New function for subr.el: sort-on |
Date: |
Sat, 25 Nov 2017 01:09:18 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
John Wiegley <address@hidden> 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