bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32841: assoc-set fails with dot notation association list


From: 陈有骏
Subject: bug#32841: assoc-set fails with dot notation association list
Date: Mon, 21 Oct 2024 16:54:54 +0800

The thread and all replies were in 2018. Six years later, in 2024, Anyone opening the up-to-date online manual still sees the old bad code there! The manual is not adjusted even though previous emails had pointed the cause and solution out!
Today, the page has a valid link of  and still contains

Alist Example

Here is a longer example of how alists may be used in practice.

(define capitals '(("New York" . "Albany")
                   ("Oregon"   . "Salem")
                   ("Florida"  . "Miami")))

;; What's the capital of Oregon?
(assoc "Oregon" capitals)       ?6?0 ("Oregon" . "Salem")
(assoc-ref capitals "Oregon")   ?6?0 "Salem"

;; We left out South Dakota.
(set! capitals
      (assoc-set! capitals "South Dakota" "Pierre"))
capitals
?6?0 (("South Dakota" . "Pierre")
    ("New York" . "Albany")
    ("Oregon" . "Salem")
    ("Florida" . "Miami"))

;; And we got Florida wrong.
(set! capitals
      (assoc-set! capitals "Florida" "Tallahassee"))
capitals
?6?0 (("South Dakota" . "Pierre")
    ("New York" . "Albany")
    ("Oregon" . "Salem")
    ("Florida" . "Tallahassee"))

;; After Oregon secedes, we can remove it.
(set! capitals
      (assoc-remove! capitals "Oregon"))
capitals
?6?0 (("South Dakota" . "Pierre")
    ("New York" . "Albany")
    ("Florida" . "Tallahassee"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]