GNU bug report logs -
#71047
[PATCH] doc: Recommend alist-copy instead of list-copy.
Previous Next
Reported by: Tomas Volf <~@wolfsden.cz>
Date: Sat, 18 May 2024 22:48:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
To reply to this bug, email your comments to 71047 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#71047
; Package
guile
.
(Sat, 18 May 2024 22:48:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tomas Volf <~@wolfsden.cz>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Sat, 18 May 2024 22:48:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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'.
---
doc/ref/api-data.texi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 3b9933d97..81552dec3 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -9509,7 +9509,7 @@ difference to you.
If you need to keep the old value of an association list in a form
independent from the list that results from modification by
@code{acons}, @code{assq-set!}, @code{assv-set!} or @code{assoc-set!},
-use @code{list-copy} to copy the old association list before modifying
+use @code{alist-copy} to copy the old association list before modifying
it.
@deffn {Scheme Procedure} acons key value alist
--
2.41.0
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Sat, 26 Oct 2024 17:35:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Tomas Volf <~@wolfsden.cz>
:
bug acknowledged by developer.
(Sat, 26 Oct 2024 17:35:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 71047-done <at> debbugs.gnu.org (full text, mbox):
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!
This bug report was last modified 27 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.