GNU bug report logs -
#32841
assoc-set fails with dot notation association list
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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 <at> 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
>
[Message part 2 (text/html, inline)]
This bug report was last modified 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.