From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: Add seq-shuffle Date: Sun, 15 Sep 2024 04:58:39 -0700 Message-ID: References: <86ldzuy8u4.fsf@hugot.nl> <86ikuxe8iu.fsf@gnu.org> <6c627288-4531-49a5-9593-c4f35ccb8b04@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38125"; mail-complaints-to="usenet@ciao.gmane.io" Cc: devel@hugot.nl, Emacs-devel@gnu.org To: Adam Porter , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 15 13:59:20 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1spnuR-0009ob-K1 for ged-emacs-devel@m.gmane-mx.org; Sun, 15 Sep 2024 13:59:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spntu-0002lT-Jy; Sun, 15 Sep 2024 07:58:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1spnts-0002lK-O2 for Emacs-devel@gnu.org; Sun, 15 Sep 2024 07:58:45 -0400 Original-Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1spntr-0005my-7A; Sun, 15 Sep 2024 07:58:44 -0400 Original-Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5c26311c6f0so4878126a12.3; Sun, 15 Sep 2024 04:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726401520; x=1727006320; darn=gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=u1AroOOih5Am/p0mKgxNhbY9HZvYZnV66k+9aSii8sE=; b=ZRLRujqMRi7uY5CykVVKbT9WTPGM6J/OCWSewKN4bNIzwZiK50scQw6fQQq4DD9JpW Bs95szJmnwCMtWzdsUiWQa1Y0nq6qNpYRjICGxehL/IHSyX3lutSyG+2j4gvY2HhKESs Zzq9P/sLC9LExvawJi9X0JNmQ871Mu5RvWxC2xNZOYUkgSwEypKW4vwGZKfJITUAKNKa 5EPWp0AH+JzM8OUvOFXgsPL4BJ79umNAhqBMWBmQBZjARATlu1S9a7G6pEjzBS0HE+7P cutebLX+P3s+YaT8gzKfhW3y52MM7aPzcqOowJIkir++UArYKl81NiwY5vQ0vAFDsyMO 1Jnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726401520; x=1727006320; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u1AroOOih5Am/p0mKgxNhbY9HZvYZnV66k+9aSii8sE=; b=CxvV244HSmi+BuW3RUsO3gesM9Q13m1fVoLq1075fAKhqiA7aQxidZa9JNZKF4mrIM rwKyawBaIczpNDTKfuW+71US20HyggJUKyEVT/Yu8JcjeXqscdCTUiWr9o/6F52QwNCX 2p8dBWtzo9HeNoEtcJD9Jczl6paKbiG9rDNo4cN4JLP+a7xH9LWx7H41uQIFVZhC71Yj iiS5yW7W67L1YXr8C+oGJV4L3/jkOyTRulWBZ3R/TGQy38MDGUcZy3pEJtVJzYP0gn25 7P2H9Ebfh0GXf8q5TqY9eejXkfx0YjqfoWSPeohwxmmeYufe9BuDWdWzSwPtqa99NGW0 RJ4w== X-Forwarded-Encrypted: i=1; AJvYcCXdkd//PWm3qOjA3NkzfSMoFehS4yOzbwx0vbiaoxo/7QO/8tfq3ZOIRa/ZVQdv8Fby6qb8dA==@gnu.org, AJvYcCXdpYR0GIVYaAKmBC1KJeto7KLIWKiO46EgAsU+SHDYkryALnRqLgw7Hyg0UWn6/qM1eAEK9+759OfLrQ==@gnu.org X-Gm-Message-State: AOJu0YzlsRAKbKrGhSFx6AKOLAjGkSx4f8zPE2xusr832BNZSqF865np TBwA10HXUiFKfYzRbEsvDd+U3nQShX+2jW/enooqSHsZTewQ6OVsKsFxFXItZhH+tQ73aa7l+zo lnhXBPB8UxNlJvl9F/bYRJuP/6txyW8g8 X-Google-Smtp-Source: AGHT+IGDCEvdhbo2l1qrA4gT6NTzvM3r9zR81q4BV33+LWdasEJ0NEuPw5QMUsQzNC1N/l9O4CtECjWNwOc2o5WpjAw= X-Received: by 2002:a05:6402:1f0e:b0:5be:fa43:8017 with SMTP id 4fb4d7f45d1cf-5c413e1eecbmr10373657a12.16.1726401519725; Sun, 15 Sep 2024 04:58:39 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 15 Sep 2024 04:58:39 -0700 In-Reply-To: <6c627288-4531-49a5-9593-c4f35ccb8b04@alphapapa.net> Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323634 Archived-At: Adam Porter 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.