unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Jens Egon Nyborg <jens@puggaard-nyborg.dk>
To: 75364@debbugs.gnu.org
Subject: bug#75364: Manual: Alist example does not work
Date: Sat, 4 Jan 2025 16:59:15 +0100	[thread overview]
Message-ID: <e21b8ece-f882-46f7-93d5-d750ceddd0a0@puggaard-nyborg.dk> (raw)

[-- 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 --]

             reply	other threads:[~2025-01-04 15:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-04 15:59 Jens Egon Nyborg [this message]
2025-01-04 21:27 ` bug#75364: Manual: Alist example does not work dsmich
2025-01-04 23:34 ` lloda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e21b8ece-f882-46f7-93d5-d750ceddd0a0@puggaard-nyborg.dk \
    --to=jens@puggaard-nyborg.dk \
    --cc=75364@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).