emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add seq-shuffle


From: Stefan Kangas
Subject: Re: Add seq-shuffle
Date: Sun, 15 Sep 2024 04:58:39 -0700

Adam Porter <adam@alphapapa.net> writes:

> 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.

Makes sense to me, FWIW.

I have had slow and naive implementations of it in my init file at
various times myself.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]