From: John Cowan <cowan@ccil.org>
To: Christopher.Hood@gtri.gatech.edu
Cc: 32841@debbugs.gnu.org
Subject: bug#32841: assoc-set fails with dot notation association list
Date: Tue, 25 Sep 2018 18:04:59 -0400 [thread overview]
Message-ID: <CAD2gp_Qvvug7w_rcVQb3_fwAMaaKKRcCO6KS=4HLeGTMn-d1GQ@mail.gmail.com> (raw)
In-Reply-To: <d61a791aaa734245ac705bb5196ff18e@gtri.gatech.edu>
[-- Attachment #1: Type: text/plain, Size: 1367 bytes --]
The error is valid, because you are attempting to mutate a program
literal. Scheme makes that an error, and Guile enforces it (though many
Schemes do not).
On Tue, Sep 25, 2018 at 4:41 PM Hood, Christopher L. <
Christopher.Hood@gtri.gatech.edu> wrote:
> This fails with code pulled straight out of the Guile manual example
> (section 6.6.20.6).
>
>
>
> (define capitals '(("New York" . "Albany")
>
> ("Oregon" . "Salem")
>
> ("Florida" . "Miami")))
>
>
>
> Okay, that works define to define alist capitals. Now let’s try another
> part of the example:
>
>
>
> (set! capitals
>
> (assoc-set! capitals "Florida" "Tallahassee"))
>
>
>
> This yields the error:
>
>
>
> ERROR: In procedure assoc-set!:
>
> In procedure set-cdr!: Wrong type argument in position 1 (expecting
> mutable pair): ("Florida" . "Miami")
>
>
>
> I’ve experienced this behavior with builds of both Guile 2.2.2 and Guile
> 2.2.4.
>
>
>
> I’ll note that if you define the alist so its initial contents are defined
> using a quasiquote and the cons form instead of dot notation, this error is
> not reached. I’m not sure if the error is valid or not, but in any case,
> the code that produces is listed as an valid example in the manual, so that
> doesn’t seem right.
>
>
>
> chris
>
[-- Attachment #2: Type: text/html, Size: 2803 bytes --]
next prev parent reply other threads:[~2018-09-25 22:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 20:33 bug#32841: assoc-set fails with dot notation association list Hood, Christopher L.
2018-09-25 22:04 ` John Cowan [this message]
2018-09-27 3:02 ` Mark H Weaver
2018-09-27 12:09 ` John Cowan
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='CAD2gp_Qvvug7w_rcVQb3_fwAMaaKKRcCO6KS=4HLeGTMn-d1GQ@mail.gmail.com' \
--to=cowan@ccil.org \
--cc=32841@debbugs.gnu.org \
--cc=Christopher.Hood@gtri.gatech.edu \
/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).