From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68863: Add support for using setf with seq-subseq Date: Tue, 14 May 2024 17:52:49 +0200 Message-ID: <87zfssl7am.fsf@web.de> References: <050ba625-2372-425f-85c6-988e2ef4cf14@protonmail.com> <86y1bvw5ff.fsf@gnu.org> <2dfd9d7f-5c63-4e1d-845c-cd245a71fc34@protonmail.com> <8d2a8d06-5b69-4587-9aab-36f7c792c623@protonmail.com> <1fca0de5-236e-428f-9224-b03a4d7d6998@protonmail.com> <5db43ef0-f218-4790-b263-a3eb80929d9b@protonmail.com> <87cypvmb8j.fsf@web.de> <538ac066-c421-4c1a-8714-0864917211e6@protonmail.com> Reply-To: Michael Heerdegen Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34134"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68863@debbugs.gnu.org, eliz@gnu.org, monnier@iro.umontreal.ca, nicolas@petton.fr To: Okamsn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 14 17:53:38 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 1s6uTB-0008eL-MB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 May 2024 17:53:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6uSf-00016w-Nh; Tue, 14 May 2024 11:53:05 -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 1s6uSc-00016K-Il for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 11:53:02 -0400 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 1s6uSc-0005Tg-9k for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 11:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s6uSb-0006wB-TN for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 11:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 May 2024 15:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68863 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: 68863@debbugs.gnu.org, "Okamsn via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\"" , Eli Zaretskii , Stefan Monnier , Nicolas Petton Original-Received: via spool by submit@debbugs.gnu.org id=B.171570197826658 (code B ref -1); Tue, 14 May 2024 15:53:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 May 2024 15:52:58 +0000 Original-Received: from localhost ([127.0.0.1]:40075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6uSX-0006vu-PY for submit@debbugs.gnu.org; Tue, 14 May 2024 11:52:58 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:43904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6uSR-0006vo-ID for submit@debbugs.gnu.org; Tue, 14 May 2024 11:52:55 -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 1s6uSP-00015r-0d for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 11:52:49 -0400 Original-Received: from mout.web.de ([217.72.192.78]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6uSM-0005Rc-E0; Tue, 14 May 2024 11:52:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1715701925; x=1716306725; i=michael_heerdegen@web.de; bh=6PrgMYbIxFzj9ayTfs7rLhHbOoCTh3n001Qx/5ocoFU=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=TEYNTvNFGFTZhmXebBf10XDvh6YYh80rCgkHhePuGkAbN0aKKNC+dA0dUaVdb13A xuOvARECJvaUIKe7sjzYBnlNrP0skOu9bM7109E22o//KkgRKDq74pO5C30+6mDgj DhCSkmeW6wdlkBYCdQl2KXkgmq/xivTNODsnCG7hOKvZUUUWCkgWj8BZydbSzn18T vLR0ygWA291BOu39tmoQVF3rFB0J/ehBOEiYw8rs+DGNxX9tehU9OZaah8nbFLvKl mM7xbbh5gxgxNd6XNNlAcaB0giGVnhMtlhoTuMZEGNM5hefdlscYTd+kOdZipEnF5 Ch+6Gyg5n7JoN7uQlg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([84.57.248.23]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MVJRl-1ryUnS1cSF-00MwBE; Tue, 14 May 2024 17:52:05 +0200 In-Reply-To: <538ac066-c421-4c1a-8714-0864917211e6@protonmail.com> (okamsn@protonmail.com's message of "Tue, 14 May 2024 12:47:14 +0000") X-Provags-ID: V03:K1:dFiEuB9vjORsj/mUf1DLVAmanLAHSuDaywFZitrA9I96/xwP3Re Upwt03NmeXVJP3c65GsEl5ta0hZPviT+Hyo03ROhBl60vOZRfgsb+8OERuNxkj3eHwQ3d3T wsBFc1+eJTDo0gVJ+vixE0chkz6yUv30b3wFtRPjp6nGw4OaH/Uo8v2B9t/mx25RqVFYAdW DPsPWF1j20j2apgv58vng== UI-OutboundReport: notjunk:1;M01:P0:e28/Xo1iIxw=;/rot1KvzHOCH4aTt3/MthjcQMU3 UWjkN3YVQ2xW/3YvYhXznBKZCbl77JYTHSHuxstngVMF94BLQL+P/W11NQ+Q9ob2KneVvlRxH pxek8nzzO4/GNJdRcIqG1+4NJFnhmYWuxFYzJegIxHqU2wU2NO/6Isf6yuKGBP/0rp4tg8g+C i9Hq+gGvlmQFjT/wzw5igdxRmXMsiZl7EjNeumoMOOqqU6GqG63VtlGJaVfkTD8h0AAiE+/Ll KBy+i9ioPUJHvKGwIuCjE/P6k+MFXlU7hwN3l4tT+6FHiaRrYL8wsfjJ6KFve6DcTHcAKuksB JFAP0O/7yZvMRSYqEAzxH1UhwOmFb/KjFeoPSO39c4bpfRyyN92/uXSr5m3d7b/EExN9tYzQr aH17PwF+9Sq15xKSy4jvr52K0Bm136trauPbUflRvYInrJKoDe6s5J6DwZeETw/jyo29tyfcZ oo+0Itku6Ur+xKpcsitCplE5GOltg24LqjwhxCeP9gZaOOkZsAzcRNQCVktGUV47lt+NkHC7d twYZdF9Px1JaofIY9Ci5zFX5crXkYSxQCebzQOBNoa2u9hu+U/N3QCeIMjOr0NLfa4aG4X/Qh condi9Ijx3eiAmxvBKMWniHjoe29CIjENti3GHFZm19jtjlDFzbzPYXwzZMTC1JSmgQ6d0+7j aaXab887LhLkhxY0LJeLjUdEw43+F2CFE25S5mwMydH9VRrjbu3gVC6blZx519OLAYKiCaoAL l5mq+BrEy4+v+gez9BWFIqWfqVdF6GlXLMG5z77GtvRlTeqmt6e/bN56IM4qRSN+4+wfZlC0 Received-SPF: pass client-ip=217.72.192.78; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:285028 Archived-At: Okamsn writes: > Here is what I have thought: > > 1. The setter should be consistent for different kinds of sequences. My > understanding is that arrays cannot be extended, so I think that it > should not be able to extend lists either. I think that something like a > non-destructive `seq-replace` or a non-destructive `seq-splice` is a > separate feature. [...] > 3. The setter should not modify the sequence containing the replacement > values. The manual states: "All functions defined in this library are > free of side-effects; i.e., they do not modify any sequence (list, > vector, or string) that you pass as an argument." I think that it makes > sense for the setter to modify the target sequence, because `setf` is > used to set places to values, but I think that it would be unexpected to > modify the sequence of replacement values and that it would be contrary > to what the manual states and how the other features behave. That's a bit of a contradiction, since when using your patch we do modify the original sequence. That's a reason why your suggestion doesn't fit that well into the current seq.el. But The main question for me is: do we want something like you suggest in seq.el. And, if we do, should we then provide this functionality as a generalized variable. And if we do offer and advertise this explicitly, it must be implemented as efficient as possible (which is not the case now). But I'm stuck with the first question. And my gut feeling is a clear "No". First, I would not provide this as gv but as a normal function. There is no necessity to go the gv way. Second, it doesn't fit into seq.el for the reason you gave: the library promises not to modify sequences. This is not cut in stone, of course. > I will try to find uses of `cl-replace` and maybe uses of `append` and > `nconc` for examples. Also, I have attached a version of the patch that > does not compute the length of the list unless needed. I'm mostly interested in real-life examples where your patch would lead to simpler, better understandable and better maintainable code; and I think Stefan, too. That you need such a functionality for your own code counts but is not enough of its own. You surely could modify your macro to do what you want without changing Emacs. Michael.