all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: Adam Porter <adam@alphapapa.net>, Eli Zaretskii <eliz@gnu.org>
Cc: devel@hugot.nl, Emacs-devel@gnu.org
Subject: Re: Add seq-shuffle
Date: Sun, 15 Sep 2024 04:58:39 -0700	[thread overview]
Message-ID: <CADwFkmk9_STFNUmDrSfN_4amzc-0F1x8ngxpHQXzEjkc6730eQ@mail.gmail.com> (raw)
In-Reply-To: <6c627288-4531-49a5-9593-c4f35ccb8b04@alphapapa.net>

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	other threads:[~2024-09-15 11:58 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
2024-09-15 11:58       ` Stefan Kangas [this message]
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=CADwFkmk9_STFNUmDrSfN_4amzc-0F1x8ngxpHQXzEjkc6730eQ@mail.gmail.com \
    --to=stefankangas@gmail.com \
    --cc=Emacs-devel@gnu.org \
    --cc=adam@alphapapa.net \
    --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.