Subject: Manual: Alist example does not work
From: Jens Egon Nyborg <[email-masked]>
To: [email-masked]
Date: Sat, 4 Jan 2025 16:59:15 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

I run

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

followed by

(set! capitals
       (assoc-set! capitals "Florida" "Tallahassee"))

and get

"ice-9/boot-9.scm:1676:22: In procedure raise-exception:
In procedure set-cdr!: Wrong type argument in position 1 (expecting 
mutable pair): ("Florida" . "Miami")

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue."

(In geiser in emacs on Arch)

Warning: In my own code it actually worked on and off.

Work-around: Use

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

apparently quoted lists are not mutable!