all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Mendler via "Emacs development discussions." <emacs-devel@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: master 4b79c80c999 1/2: New function 'sort-on'
Date: Fri, 02 Feb 2024 17:05:33 +0100	[thread overview]
Message-ID: <87y1c2hmwi.fsf@daniel-mendler.de> (raw)
In-Reply-To: <86y1c250m0.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 02 Feb 2024 17:47:51 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Daniel Mendler <mail@daniel-mendler.de>
>> Cc: emacs-devel@gnu.org
>> Date: Fri, 02 Feb 2024 16:26:58 +0100
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> Would this function fit into the seq library, named seq-sort-on?
>> >
>> > "Fit" in what sense?
>> 
>> The function works with other sequence types too and it seems a good
>> idea to collect sequence-related functionality in seq.el.
>
> OK, but the result is always a list, something seq.el doesn't do.

Right. Seq functions usually return sequences of the same type as the
argument type. I've found one exception though: `seq-keep' always
returns lists. Maybe `seq-keep' should be corrected?

I propose to generalize `sort-on' to other sequence types.

>> > This function can only sort lists, so at least from that aspect its
>> > place is not in seq.el.  In addition, I see no reason to have it
>> > preloaded.
>> 
>> No, in the current form, the function works on vectors too. It always
>> returns a list though. But maybe it makes sense to generalize it such
>> that it returns the same type as the argument.
>
> I see no reason to preload this function, anyway.

Agree, this is certainly a reason. However if the function is general
and useful enough, this should not prevent making it part of seq.el.
There have been additions to seq.el in the past. Of course each addition
has to be considered carefully. The same applies to additions to
subr.el.

>> > I've put it in sort.el because the function 'sort' is there.
>> 
>> No, sort is defined in src/fns.c.
>
> And your point is...?

My point is that sort.el is not the ideal place for this function. As
Michael mentioned, sort.el provides commands to sort lines, paragraphs
and other units of text in buffers. In contrast, new `sort-on' function
is a small library function, so it should better be added to subr.el or
subr-x.el, or with a different name to seq.el.

Daniel



  reply	other threads:[~2024-02-02 16:05 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <170688047526.14693.2994051491358257471@vcs2.savannah.gnu.org>
     [not found] ` <20240202132756.4272CC0EFE7@vcs2.savannah.gnu.org>
2024-02-02 15:00   ` master 4b79c80c999 1/2: New function 'sort-on' Daniel Mendler via Emacs development discussions.
2024-02-02 15:04     ` Eli Zaretskii
2024-02-02 15:26       ` Daniel Mendler via Emacs development discussions.
2024-02-02 15:47         ` Eli Zaretskii
2024-02-02 16:05           ` Daniel Mendler via Emacs development discussions. [this message]
2024-02-05 12:14             ` Michael Heerdegen
2024-02-02 15:55         ` Dmitry Gutov
2024-02-02 15:30       ` Michael Heerdegen via Emacs development discussions.
2024-02-02 15:35         ` Daniel Mendler via Emacs development discussions.
2024-02-02 16:08           ` Michael Heerdegen via Emacs development discussions.
2024-02-02 16:23             ` Daniel Mendler via Emacs development discussions.
2024-02-02 16:43               ` Michael Heerdegen via Emacs development discussions.
2024-02-02 15:50         ` Eli Zaretskii
2024-02-02 16:06           ` Eshel Yaron
2024-02-02 16:34             ` Eli Zaretskii
2024-02-02 16:46           ` Michael Heerdegen via Emacs development discussions.
2024-02-02 17:55             ` Emanuel Berg
2024-02-05  0:48           ` Dmitry Gutov
2024-02-05  5:30             ` Yuri Khan
2024-02-05 12:52               ` Eli Zaretskii
2024-02-05 13:25               ` Dmitry Gutov
2024-02-05 14:31                 ` Eli Zaretskii
2024-02-05 14:47                   ` Dmitry Gutov
2024-02-05 15:10                     ` Eli Zaretskii
2024-02-05 15:29                       ` Dmitry Gutov
2024-02-28  7:40                 ` Michael Heerdegen
2024-03-01 23:37                   ` Dmitry Gutov
2024-03-04  6:45                     ` Michael Heerdegen
2024-03-04 16:43                       ` Dmitry Gutov
2024-03-05  8:06                         ` Michael Heerdegen
2024-03-05 10:21                           ` Michael Heerdegen via Emacs development discussions.
2024-03-05 12:39                             ` Eli Zaretskii
2024-03-06  3:20                               ` Michael Heerdegen
2024-03-06 12:10                                 ` Eli Zaretskii
2024-03-06 18:34                                   ` Dmitry Gutov
2024-03-06 20:12                                     ` John Wiegley
2024-03-07  1:34                                       ` Dmitry Gutov
2024-03-05 12:44                             ` Dmitry Gutov

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

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

  git send-email \
    --in-reply-to=87y1c2hmwi.fsf@daniel-mendler.de \
    --to=emacs-devel@gnu.org \
    --cc=eliz@gnu.org \
    --cc=mail@daniel-mendler.de \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.