From: Adam Porter <adam@alphapapa.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: devel@hugot.nl, Emacs-devel@gnu.org
Subject: Re: Add seq-shuffle
Date: Sun, 15 Sep 2024 01:45:01 -0500 [thread overview]
Message-ID: <6c627288-4531-49a5-9593-c4f35ccb8b04@alphapapa.net> (raw)
In-Reply-To: <86ikuxe8iu.fsf@gnu.org>
On 9/15/24 01:27, Eli Zaretskii wrote:
>> Date: Sat, 14 Sep 2024 20:44:16 -0500
>> Cc: Emacs-devel@gnu.org
>> From: Adam Porter <adam@alphapapa.net>
>>
>> Thanks, this is a gap in functionality that should be filled.
>
> Not every gap _should_ be filled, no. Only those we think (and have
> some basis to think) it is going to be missed by enough real-life Lisp
> programs.
>
> So saying "should be filled" without explaining why you think it
> should be filled is less convincing than it could have been. Thus, I
> urge you to add motivation for your opinion. TIA.
I think it should be filled because it's not an uncommon thing to want
to do (e.g. it's needed in Listen.el and Elfeed), and it's not obvious
how to do it from scratch, especially in a performant way. A "naive"
implementation, without regard for performance, can perform quite poorly.
That there are different sequence types, each with their own
characteristics, further complicates the matter. For newer Elisp
programmers, who may be unfamiliar with the various types and
performance issues in Elisp, having a built-in function to do it
correctly and quickly would be helpful.
As it is, we have had various implementations in various third-party
libraries for years, each with the same purpose but doing it slightly
differently. As an example from other languages, Python provides the
random.shuffle function for sequences. It would seem natural for
Emacs's seq library to provide a similar function.
It's not a big deal, but if I had a vote, it would be to include such a
function in seq.el.
--Adam
next prev parent reply other threads:[~2024-09-15 6:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-14 7:48 Add seq-shuffle Hugo Thunnissen
2024-09-14 8:42 ` Philip Kaludercic
2024-09-16 5:08 ` Emanuel Berg
2024-09-16 19:17 ` Adam Porter
2024-09-17 4:09 ` Emanuel Berg
2024-09-17 18:37 ` Philip Kaludercic
2024-09-17 22:26 ` Adam Porter
2024-09-18 1:27 ` Emanuel Berg
2024-09-17 18:53 ` Yuri Khan
2024-09-15 1:44 ` Adam Porter
2024-09-15 6:27 ` Eli Zaretskii
2024-09-15 6:45 ` Adam Porter [this message]
2024-09-15 11:58 ` Stefan Kangas
2024-09-15 7:48 ` Hugo Thunnissen
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=6c627288-4531-49a5-9593-c4f35ccb8b04@alphapapa.net \
--to=adam@alphapapa.net \
--cc=Emacs-devel@gnu.org \
--cc=devel@hugot.nl \
--cc=eliz@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 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.