From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Cowan Newsgroups: gmane.lisp.guile.bugs Subject: bug#32841: assoc-set fails with dot notation association list Date: Tue, 25 Sep 2018 18:04:59 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ac204b0576b94c44" X-Trace: blaine.gmane.org 1537913045 7674 195.159.176.226 (25 Sep 2018 22:04:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Sep 2018 22:04:05 +0000 (UTC) Cc: 32841@debbugs.gnu.org To: Christopher.Hood@gtri.gatech.edu Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Wed Sep 26 00:04:01 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4vR2-0001sE-JG for guile-bugs@m.gmane.org; Wed, 26 Sep 2018 00:04:00 +0200 Original-Received: from localhost ([::1]:55433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4vT9-000168-80 for guile-bugs@m.gmane.org; Tue, 25 Sep 2018 18:06:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4vT3-00015o-JQ for bug-guile@gnu.org; Tue, 25 Sep 2018 18:06:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4vT0-0001SK-De for bug-guile@gnu.org; Tue, 25 Sep 2018 18:06:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49882) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g4vT0-0001Rz-65 for bug-guile@gnu.org; Tue, 25 Sep 2018 18:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g4vSz-0004lU-Uz for bug-guile@gnu.org; Tue, 25 Sep 2018 18:06:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Cowan Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 25 Sep 2018 22:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32841 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 32841-submit@debbugs.gnu.org id=B32841.153791312018267 (code B ref 32841); Tue, 25 Sep 2018 22:06:01 +0000 Original-Received: (at 32841) by debbugs.gnu.org; 25 Sep 2018 22:05:20 +0000 Original-Received: from localhost ([127.0.0.1]:54140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4vSK-0004kX-2e for submit@debbugs.gnu.org; Tue, 25 Sep 2018 18:05:20 -0400 Original-Received: from mail-wr1-f51.google.com ([209.85.221.51]:32964) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4vSG-0004kH-OU for 32841@debbugs.gnu.org; Tue, 25 Sep 2018 18:05:18 -0400 Original-Received: by mail-wr1-f51.google.com with SMTP id f10-v6so3870377wrs.0 for <32841@debbugs.gnu.org>; Tue, 25 Sep 2018 15:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccil-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MskSPsXUiL1Z3l3G3M+h8gKOxjQiRp7kGZious7pfxY=; b=mNUYZ+RWiNKIHlfxhRcVP1691JwFmdIBAzOgl0KuNY+g2d3zp3BPcZ0LNuew5f+QMW HKXbUafa1p1sW4rPYQ0sjtY5ghPE5GPsp5J6NElyU25LWqNRTv/QQIZvbsM/5Cz5c64F TsYmozOtSQVWml2g1BkNZ4x7zP9kNnUSU8jYd5/6Ot6Ij1IoATcfCkwQrc7dxRsvQXEq oFcByLhwjElhthimj5cdovBtaJEmg5VNzGKOPtGvNo1dyeHNJogYCLKTM7Uo91RqnRfr tlpxkSlO7A8Nie7feZqXSb+v9P92KH0UdF5BudfHTstNcWFiWaLlfGthLYxbwI/xOVNl obuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MskSPsXUiL1Z3l3G3M+h8gKOxjQiRp7kGZious7pfxY=; b=L7WggzkB4pWEue/HGTsoSOsKiJbf/TV+WKcxijSXYFA4qbQPkr4wM0bciah+t3AzMa PqFAGHrIONvBrFqaUo35f7goPrqVroWukb253H0w6zsIR0vHtKzznlblDq1j1lxbeoIr iSe/QTzQ7k9xk4fp5OwpEtWqkzrdIKu1MS8neHoY3/zmFHFH5/Z7BGpkYn7SrPmPRO6M rWAhFQSBII8i+VRCqx9zqXmS/XViiVGun4V43ttCuUSOJvqw4NEq+AaH0FgxQWErnXRI byo6hfUOuqXXdPaNsjmqtv+4IeprYz+2VHv7NVyqevkzePvUuYIpGLkwbTXtUbGwTHga Lqzw== X-Gm-Message-State: ABuFfoi4lZEOM/4Z9WQ0ciT8IeJLWEE+fgXWLmsohKAwK/IsYTSoWXhk rgd3UcM/JietjLImMctjmK08yao2YlOT5/hnFoOvSA== X-Google-Smtp-Source: ACcGV617Ty5M7P7EAej8EpdPibslq0YMfdVRTsrCh0WTN7WBBtrPUcn4Yyyh5uv38d4+7ijCOIOQWfg4SG58+lcGeFY= X-Received: by 2002:a5d:434c:: with SMTP id u12-v6mr2586918wrr.189.1537913110926; Tue, 25 Sep 2018 15:05:10 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9169 Archived-At: --000000000000ac204b0576b94c44 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=99s try a= nother > 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=E2=80=99ve experienced this behavior with builds of both Guile 2.2.2 an= d Guile > 2.2.4. > > > > I=E2=80=99ll note that if you define the alist so its initial contents ar= e defined > using a quasiquote and the cons form instead of dot notation, this error = is > not reached. I=E2=80=99m not sure if the error is valid or not, but in an= y case, > the code that produces is listed as an valid example in the manual, so th= at > doesn=E2=80=99t seem right. > > > > chris > --000000000000ac204b0576b94c44 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The error is valid, because you are attempting to mutate a= program literal.=C2=A0 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.e= du> wrote:

This fails with code pulled straight out of the Guil= e manual example (section 6.6.20.6).

=C2=A0

(define capitals '(("New York" . "Alban= y")

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ("Oregon"=C2= =A0=C2=A0 . "Salem")

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ("Florida"=C2= =A0 . "Miami")))

=C2=A0

Okay, that works define to define alist capitals. No= w let=E2=80=99s try another part of the example:

=C2=A0

(set! capitals
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (assoc-set! capitals "Florida"=
; "Tallahassee"))

=C2=A0

This yields the error:

=C2=A0

ERROR: In procedure assoc-set!:

In procedure set-cdr!: Wrong type argument in positi= on 1 (expecting mutable pair): ("Florida" . "Miami")=

=C2=A0

I=E2=80=99ve experienced this behavior with builds o= f both Guile 2.2.2 and Guile 2.2.4.

=C2=A0

I=E2=80=99ll note that if you define the alist so it= s initial contents are defined using a quasiquote and the cons form instead= of dot notation, this error is not reached. I=E2=80=99m not sure if the er= ror is valid or not, but in any case, the code that produces is listed as an valid example in the manual, so that doesn=E2=80= =99t seem right.

=C2=A0

chris

--000000000000ac204b0576b94c44--