From unknown Mon Jun 23 04:10:34 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#59595 <59595@debbugs.gnu.org> To: bug#59595 <59595@debbugs.gnu.org> Subject: Status: [PATCH 1/3] Add examples and incomplete wordings. Reply-To: bug#59595 <59595@debbugs.gnu.org> Date: Mon, 23 Jun 2025 11:10:34 +0000 retitle 59595 [PATCH 1/3] Add examples and incomplete wordings. reassign 59595 guile submitter 59595 Yuval Langer severity 59595 normal tag 59595 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 25 23:10:23 2022 Received: (at submit) by debbugs.gnu.org; 26 Nov 2022 04:10:23 +0000 Received: from localhost ([127.0.0.1]:37614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oymWE-0003Wi-O4 for submit@debbugs.gnu.org; Fri, 25 Nov 2022 23:10:23 -0500 Received: from lists.gnu.org ([209.51.188.17]:46712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oyf5x-0002Ct-AU for submit@debbugs.gnu.org; Fri, 25 Nov 2022 15:14:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oyf5x-0007zm-5k for bug-guile@gnu.org; Fri, 25 Nov 2022 15:14:45 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oyf5v-0002lu-Lc for bug-guile@gnu.org; Fri, 25 Nov 2022 15:14:44 -0500 Received: by mail-wr1-x434.google.com with SMTP id bs21so8311578wrb.4 for ; Fri, 25 Nov 2022 12:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Wj++yw+BBC2iESJ589GOVKwWr+zTvuf3JRkcvp6Cr2I=; b=l6QiBzE9XO/NcY0tkIAND6otAR8eFYjdXuOScDbup+UDqkWSnkC7Awq5CeXPeByZZu IA76JQRc/BxRO9mbRYsd8vmRfqTVg/IkH3PBvja50kC+fN+dd54kWs+/LgOLaJ43QOLt Jwr3TYfl679F0XeRfuJ8aUGvD2EcUuQv3a8mSg+ZqvYbQaOvxjL/VVv6K0pU2uV1CWpX UCQF3gFNUipMfRFNMMBnFWfG3Z8J7Di9jaFTMv1dvtbRKrIrSn1r2IKy7GxcvcivRR56 t+hxteIFfiNHn57JsPl1tw9KbN2JxrKY2p8n4+hrvKYS4EqHSRKqEBzKAqLy2dmWDVm2 xyDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Wj++yw+BBC2iESJ589GOVKwWr+zTvuf3JRkcvp6Cr2I=; b=J8rDypWXvFlI51f8W9wnQRrxv921YJFVIke9iSVzrmkKrfj62AXHNt9VTIKzI85Ss8 3O0EP/qxh9mwVENuj8U62l8AbkwDkpTq+eDhxfo07jtK14MWSj2STMJiocCs3EPuj9h0 vQu4T77zzrgrG05SGKLdCe7GBpORYRToQfW72ICiUB8mJoXngYHMFr8E60F+gDg/PgdQ p6pzvzPjRFP5Te9hBDEdecsvykzh7x2j/yzU+HUn+8svKFoZMz8Rmhw687Vd+wGSoZc6 vAqEIs9FZsBuu0Tiz4JOdupmJkoysv8Rzj6jUkEYFpcdTV/A9fN1vtSRm4cxrxGUEWWF 8kuA== X-Gm-Message-State: ANoB5pnrdwfaZ48J8juoDCCCRZpAxQgVznJA41VGgp9AIV2lPSVRV/np wa/O0P9sBKinOH7SsZPsCFKrXQK1gdM= X-Google-Smtp-Source: AA0mqf5QgOj6LshvCxHLZ0hryP6iLtOwNF6aQBKwlk84CPr6JkNceIWvPvISD9wiel896OOdU8Zrkg== X-Received: by 2002:a5d:52cb:0:b0:236:4a87:2c25 with SMTP id r11-20020a5d52cb000000b002364a872c25mr24123785wrv.19.1669407281312; Fri, 25 Nov 2022 12:14:41 -0800 (PST) Received: from localhost.localdomain ([109.253.170.222]) by smtp.gmail.com with ESMTPSA id a12-20020adfe5cc000000b0022cc3e67fc5sm4301419wrn.65.2022.11.25.12.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 12:14:40 -0800 (PST) From: Yuval Langer To: bug-guile@gnu.org Subject: [PATCH 1/3] Add examples and incomplete wordings. Date: Fri, 25 Nov 2022 22:14:34 +0200 Message-Id: <20221125201436.35241-1-yuvallangerontheroad@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=yuvallangerontheroad@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 25 Nov 2022 23:10:16 -0500 Cc: Yuval Langer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --- doc/ref/api-data.texi | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index 8658b9785..8c18b4d40 100644 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -4767,7 +4767,7 @@ It also allows further properties to use the same symbols among their possible values without becoming ambiguous: @lisp -(define car1-properties '((colour . red) +(define car2-properties '((colour . red) (transmission . manual) (fuel . unleaded) (steering . power-assisted) @@ -4793,6 +4793,37 @@ extract or change individual pieces of information: (locking . manual))) @end lisp +Notice that if we try the same @code{assq-set!} call with +@code{car2-properties}, we get an exception: + +@lisp +(assq-set! car2-properties 'seat-colour 'black) +@end lisp + +This is due to the fact that literal alists are immutable. If you want +to mutate an alist, you must define it using the @code{acons} +constructor: + +@lisp +(define car3-properties (acons 'colour 'red + (acons 'transmission 'manual + (acons 'fuel 'unleaded + (acons 'steering 'power-assisted + (acons 'seat-colour 'red + (acons 'locking 'manual '()))))))) + +(assq-ref car3-properties 'seat-colour) @result{} red +(assq-set! car3-properties 'seat-colour 'black) +@result{} +((colour . red) + (transmission . manual) + (fuel . unleaded) + (steering . power-assisted) + (seat-colour . black) + (locking . manual))) +(assq-ref car3-properties 'seat-colour) @result{} black +@end lisp + Hash tables also have keys, and exactly the same arguments apply to the use of symbols in hash tables as in association lists. The hash value that Guile uses to decide where to add a symbol-keyed entry to a hash -- 2.30.2