unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#75364: Manual: Alist example does not work
@ 2025-01-04 15:59 Jens Egon Nyborg
  2025-01-04 21:27 ` dsmich
  2025-01-04 23:34 ` lloda
  0 siblings, 2 replies; 3+ messages in thread
From: Jens Egon Nyborg @ 2025-01-04 15:59 UTC (permalink / raw)
  To: 75364

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

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!

[-- Attachment #2: Type: text/html, Size: 2815 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-04 23:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-04 15:59 bug#75364: Manual: Alist example does not work Jens Egon Nyborg
2025-01-04 21:27 ` dsmich
2025-01-04 23:34 ` lloda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).