From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#71047: [PATCH] doc: Recommend alist-copy instead of list-copy. Date: Sat, 26 Oct 2024 19:33:42 +0200 Message-ID: <87r082u5u1.fsf@gnu.org> References: <20240518224707.28233-1-~@wolfsden.cz> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33964"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 71047-done@debbugs.gnu.org To: Tomas Volf <~@wolfsden.cz> Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Oct 26 19:34:47 2024 Return-path: Envelope-to: guile-bugs@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 1t4kgZ-0008iN-9r for guile-bugs@m.gmane-mx.org; Sat, 26 Oct 2024 19:34:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4kgI-0004XR-CB; Sat, 26 Oct 2024 13:34:30 -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 1t4kgG-0004Wb-VL for bug-guile@gnu.org; Sat, 26 Oct 2024 13:34:28 -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 1t4kgG-0001D4-Mf for bug-guile@gnu.org; Sat, 26 Oct 2024 13:34:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=aCHB4xoDbRhpIcukP6biGHDJZorriqHPxX/RezNWPvg=; b=M58Zop1N/7EuYRujPW3JDjyDZYaFb2tSyZzDDnAXvlrADGWorX3nvPuyAnkCQVtyKdi13DMgVHazJPlNyDoS+CIPGAUuFXhXVn8bAVWKZyaI3yHD2DIV7phuQdl3lFMo2pHIC62IZvsMy0gNKE3V1Uibl0NA6seBmffXveTkGsg9W7s+pVZy59TiyaoFITU5h7MlR5f6s8k71VEOjNZTCVOvDqqC/LQWgZKtbGym5T9AjU7YsWG+Td3G27+cdl6Ih4pXIjFhDipXq+2Wv++qynzyxjuUka7LhLvbzN+9njiAkEYhNSuK2/49kZw1M4rK2Viwc7pB/yGVovsCOmFWBA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t4kgo-0000lX-9H for bug-guile@gnu.org; Sat, 26 Oct 2024 13:35:02 -0400 Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Sat, 26 Oct 2024 17:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 71047 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Mail-Followup-To: 71047@debbugs.gnu.org, ludo@gnu.org, ~@wolfsden.cz Original-Received: via spool by 71047-done@debbugs.gnu.org id=D71047.17299640652873 (code D ref 71047); Sat, 26 Oct 2024 17:35:02 +0000 Original-Received: (at 71047-done) by debbugs.gnu.org; 26 Oct 2024 17:34:25 +0000 Original-Received: from localhost ([127.0.0.1]:42467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4kgD-0000kH-EJ for submit@debbugs.gnu.org; Sat, 26 Oct 2024 13:34:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4kgB-0000k3-Gc for 71047-done@debbugs.gnu.org; Sat, 26 Oct 2024 13:34:24 -0400 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 1t4kfY-00019O-Gj; Sat, 26 Oct 2024 13:33:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=aCHB4xoDbRhpIcukP6biGHDJZorriqHPxX/RezNWPvg=; b=FlKrfuI1A7iaupcESIlU W1cNKV8JBHWKB1ScLSVQBSazr8WhviobCb+dhlGSPYcubahUQKRUh9Zx+ES7A/mN5msvfQNIr3Txb Lsw2qEiccWA8NWF5u/U5tx3bRjGdijyjeO8tiB1PU1/YsKWapgEBxvAO8ytTCc+esMTDpPFMbsTsi EUmRasVwD/Ut8UK9use2DSAAbsBgEQk02btQsk3y0Xl7BRgXnNJngAHDor5PduAwWie+HPouWGduB vlCUUcK9y0Uv92hGfP97LU91ODIXYIPpLd5szI8uwXRYGpdc5204g5aVmrX8U7YVOwcLsNSVazrxY p9RaqfaDDjcwng==; In-Reply-To: <20240518224707.28233-1-~@wolfsden.cz> (Tomas Volf's message of "Sun, 19 May 2024 00:47:07 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:11083 Archived-At: Tomas Volf <~@wolfsden.cz> skribis: > The current recommendation of `list-copy' is not right and does not lead > to preserving the original list: > > scheme@(guile-user)> (define x (list (cons 'a 1) (cons 'b 2))) > scheme@(guile-user)> (define y (list-copy x)) > scheme@(guile-user)> (assq-set! y 'b 3) > $1 = ((a . 1) (b . 3)) > scheme@(guile-user)> x > $2 = ((a . 1) (b . 3)) > > Correct approach seems to be use `alist-copy' from SRFI-1 leading to the > expected behavior of: > > scheme@(guile-user)> ,use (srfi srfi-1) > scheme@(guile-user)> (define x (list (cons 'a 1) (cons 'b 2))) > scheme@(guile-user)> (define y (alist-copy x)) > scheme@(guile-user)> (assq-set! y 'b 3) > $1 = ((a . 1) (b . 3)) > scheme@(guile-user)> x > $2 = ((a . 1) (b . 2)) > > * doc/ref/api-data.texi (Adding or Setting Alist Entries): Recommend > `alist-copy'. Applied, thanks!