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>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sat, 26 Oct 2024 19:33:42 +0200
with message-id <87r082u5u1.fsf <at> gnu.org>
and subject line Re: bug#71047: [PATCH] doc: Recommend alist-copy instead of list-copy.
has caused the debbugs.gnu.org bug report #71047,
regarding [PATCH] doc: Recommend alist-copy instead of list-copy.
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
71047: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71047
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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
[Message part 3 (message/rfc822, inline)]
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 300 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.