From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Add seq-random-elt Date: Sat, 22 Oct 2016 10:53:06 -0400 Message-ID: <51c14fd8-cfa7-6c49-ef3c-0cb8e6eba5ff@gmail.com> References: <878ttime2i.fsf@cassou.me> <87bmyd8lwx.fsf@petton.fr> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Saq8w8t3RgCp9lanhurMKKUM2Fq3SHAF1" X-Trace: blaine.gmane.org 1477148017 18827 195.159.176.226 (22 Oct 2016 14:53:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 22 Oct 2016 14:53:37 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 22 16:53:28 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxxfs-0003j8-0k for ged-emacs-devel@m.gmane.org; Sat, 22 Oct 2016 16:53:28 +0200 Original-Received: from localhost ([::1]:37624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxxfu-0004qT-1B for ged-emacs-devel@m.gmane.org; Sat, 22 Oct 2016 10:53:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxxfl-0004q9-15 for emacs-devel@gnu.org; Sat, 22 Oct 2016 10:53:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxxfh-0000np-Vn for emacs-devel@gnu.org; Sat, 22 Oct 2016 10:53:21 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.135]:59668) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxxfh-0000nj-Ip for emacs-devel@gnu.org; Sat, 22 Oct 2016 10:53:17 -0400 Original-Received: from [192.168.1.109] ([67.186.135.89]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0MaX6b-1cD0Tr2lEv-00K7CJ for ; Sat, 22 Oct 2016 16:53:15 +0200 In-Reply-To: X-Provags-ID: V03:K0:0XNT72MnFH28XVjtIRZo0Tf31g82n3a40+NxMachpYZBSSuUuMz sI64eA5EakLDrUhN0t6YwWlxWmmrEcMScRjvPC9cfEIo3NHjqOhsDeQablCaRjcPU+HQVWC +FO95YLTZXm9XYUwMvDWZblOyx1bCa25RERqU4+a2pT9SRT3fdEZAzIarqCIdIenoUAj9k5 InP1C8CwqPvIT3RPx9ovA== X-UI-Out-Filterresults: notjunk:1;V01:K0:kLp6KyzpSXU=:Ph52awuX0NiYbFb6WVgnbU Sty6IG/CJde5Jw6C6Png43tm7r6ldPS/TlAs80le1V45ZzSJ6ApZhQcMk6NSBy/N64F/6mNk9 nHJVTsK2xQRuqC0556KJTZzIStmGDzLapqJU5X9wBJNMEz0nlRt5JLDbtDUBjchBHFGBJzOI8 hculGxdA3+WEj5DvImsQAfrTgnlwmEdXBsrPG7S/xupZ/waLTjWDXytRtW/At8/IvXEflwRbF Bw+0CUsjm51MWgLIgETEAh5tW179iRIHaKI3lZc6IGUgVUzpAE0D/O3W9f/r3aXCVUXzAZOPj WA/RT0lP2D9ufi46YoPRGk8L62rNgkFhy1uWEFIi4vACLPEpNMZ3hrJXxcmxV3itmZcq5WKrP DFA+cJHlgbWwXCOvciWWnuO32UaIZvhnE6vVb/zC1AJVcqS7zuXqdkBgmb1hatwBgQZkV4iUN ncdpSAuvGHjvWG2rkF2xLCUKeVTbyjx/G9HBk96cOOjuED/Pk4iANF97nxGcW0yIPNAUUJqgS kZlOSGbEjQCEqq5gSTTZBuqTDXwL+i4xUYTdZE6W+YNdlKe3+Rfp/MkN7p03cC/ZcCZdCmsFu 2hwLfwgvT9omeBH6nsQJK7RUndn8+wcb/Iq4UlIvHgYRvB5sZfHfaUEuGqEGfd2JD164tPQbL VWafC4xKBkYNeAb1cmqppFpjm9lxsEm0wCpsKq6yto+WQhO1Bgqn8EYh+aFgv9IB9Da8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.135 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:208596 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Saq8w8t3RgCp9lanhurMKKUM2Fq3SHAF1 Content-Type: multipart/mixed; boundary="mR4GKaV1QlIoq4bd6LLxJmHVlhpl4FjVk"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: <51c14fd8-cfa7-6c49-ef3c-0cb8e6eba5ff@gmail.com> Subject: Re: Add seq-random-elt References: <878ttime2i.fsf@cassou.me> <87bmyd8lwx.fsf@petton.fr> In-Reply-To: --mR4GKaV1QlIoq4bd6LLxJmHVlhpl4FjVk Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2016-10-21 17:30, Stefan Monnier wrote: >>> Hmm... do we really need that? What's the benefit? >> I think it's convenient. Accessing random elements of sequences is no= t >> uncommon. >=20 > Right, but >=20 > (seq-elt L (random (seq-length L))) >=20 > it pretty convenient to write and pretty clear as well, so the benefit > seems slim. Indeed, but it's arguably wrong: if L is nil, random will ignore limit an= d possibly return a negative number. seq-elt is unspecified for negative= indices AFAICT (though it seems to return nil ATM). So maybe we could/should have a seq-random-element, and it should check f= or nil. If it did, then it would be a useful addition, I think. Cheers, Cl=E9ment. --mR4GKaV1QlIoq4bd6LLxJmHVlhpl4FjVk-- --Saq8w8t3RgCp9lanhurMKKUM2Fq3SHAF1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYC31XAAoJEPqg+cTm90wjrsAP/i851IHO4n6gM6cukbB78k9f 6DifdKHivNjbobnTKCOJMhe4nzNK4Ea/bj3ZpfUKT7NIxXuObzwZUUN5FZh0LGlX 7HoVgM7ZC0cCV59fSdxgO0IzNTSZoXHUCJEQY6xATkci6nHqWwNg442jLbGCTWDG 51205EnmRrH6akCka9l8rqbLbDCeaM4EXXECVFIScCmv9RqVa8JSmUlhm4w5Bow3 xQ5qbTY4SupzJZHs4/sO1Hj1sf1ef0fbA2ods9AsjF437ogCHAq7NVruVZZPZ8Ti NPw75szL+2zrnJxxXA/lNTp99J7SJNRFCjWLl/hvlWfpCoRcoDxEz5voLchjxd5R VcQPjbK1A3lqLjIHr1ujqEiyCPgCFpFOy1Nbij0P3b3Q6287ny6za3QMKZdsLEgU LKczivvw17RN6UD+nK/D0Emm6mM0ZfrJ7kNBw0hZsfDVt/Y8L97Y/l5yY0wNqMFh YAYG2ljAIFh6YB0X1RZ/ye3/vjl/4YRv3JX6Q7P2NR2sLG6nFSaRx22jQ//g46EI 7t4NOoYhN5uUgB6Q/Q0HSAPktCfAt8xveIuaBn2Rfyc1GvqnSsyEGJZmjTqSxqCw 6fUyUXpos/bG2Fk95zYbpJXERKhcr6QyBpSNJ07kDtg67LHbCqXxFdyZven74GAc 5w07LJ2/EaT+RBSVI4Aq =TMrT -----END PGP SIGNATURE----- --Saq8w8t3RgCp9lanhurMKKUM2Fq3SHAF1--