From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#68863: Add support for using setf with seq-subseq Date: Thu, 08 Feb 2024 13:39:48 +0200 Message-ID: <86y1bvw5ff.fsf@gnu.org> References: <050ba625-2372-425f-85c6-988e2ef4cf14@protonmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2526"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68863@debbugs.gnu.org To: Okamsn , Nicolas Petton , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 08 12:41:08 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rY2mB-0000Uk-R1 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Feb 2024 12:41:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rY2lx-0002th-9L; Thu, 08 Feb 2024 06:40:53 -0500 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 1rY2lt-0002sf-Cd for bug-gnu-emacs@gnu.org; Thu, 08 Feb 2024 06:40:49 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rY2lr-00079X-SD for bug-gnu-emacs@gnu.org; Thu, 08 Feb 2024 06:40:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rY2m5-0001bA-Td for bug-gnu-emacs@gnu.org; Thu, 08 Feb 2024 06:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Feb 2024 11:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68863 X-GNU-PR-Package: emacs Original-Received: via spool by 68863-submit@debbugs.gnu.org id=B68863.17073924166078 (code B ref 68863); Thu, 08 Feb 2024 11:41:01 +0000 Original-Received: (at 68863) by debbugs.gnu.org; 8 Feb 2024 11:40:16 +0000 Original-Received: from localhost ([127.0.0.1]:59265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rY2lM-0001Zy-Gf for submit@debbugs.gnu.org; Thu, 08 Feb 2024 06:40:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rY2lJ-0001Zg-Ts for 68863@debbugs.gnu.org; Thu, 08 Feb 2024 06:40:15 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rY2ky-0006ry-NS; Thu, 08 Feb 2024 06:39:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=m//bqq0/jk7+J29E6LyoPnxkI+LNakViQf5sGZf6cMA=; b=gXVlsyJrO16g SxtV6xNFywmrMk0SEt6cNxN45wMJ5t3ZdInT2wuYL9izfEkDx2ETOgOdNgJpoNcX9r0HK5VRPCh6a AgDQ74z4Hna+rVOCjIf3sNJDMRP1wptFRGRVDh+8k5LnSqqsvcMBgpAfys5XFYNIJHN5Oxs1OurwO Wv299ocwsxOHqci+C+YS0PwtZSn5ajeLXcBuvrDGD4jxeanoKuOytWmB+t69+cVlEhIgyW4F40U2G vJ+wuoI1sw+VIR2LJpkOBu7C2uBalRk+M+ww3DjMB4AVasRMcUytOlVRvDPp3xzpKLNN5xusmjNpW NSv75bjRSp9Rf7+QOtCNSQ==; In-Reply-To: <050ba625-2372-425f-85c6-988e2ef4cf14@protonmail.com> (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279619 Archived-At: > Date: Thu, 01 Feb 2024 03:31:10 +0000 > From: Okamsn via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > This patch adds support for using `seq-subseq` with `setf`, as in > > ;; => [0 1 2 10 11] > (let ((seq (vector 0 1 2 3 4))) > (setf (seq-subseq seq -2) (list 10 11 12 13 14)) > seq) > > The patch adds a generic version which uses the existing `setf` support > of `seq-elt` and a specialized version for modifying lists. Both > versions use `seq-do` to map a function over the values that should > replace the values in the modified sequence. > > To avoid modifying more values than specified, that modifying function > uses a `when` condition. I'm not sure of a good way to stop `seq-do` > early when we know that it can stop calling the modifying function. > Normally, I would use `cl-block` and `cl-return`. Is it OK to use those > features in `seq.el`? If not, is it worth adding something like a > `seq-map-while` or a `seq-do-while`? Thanks. Nicolas, Stefan: any comments? seq.el is preloaded, so we should consider whether this addition is important enough to have it in seq or elsewhere, if we think it's useful.