From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: let-alist can't deal with the keys which includes spaces. Date: Tue, 20 Jul 2021 21:21:32 +0800 Message-ID: References: <20210720124903.GA9052@tuxteam.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40185"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 20 15:22:26 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5pha-000AIG-EM for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 20 Jul 2021 15:22:26 +0200 Original-Received: from localhost ([::1]:34476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5phZ-0005y8-GA for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 20 Jul 2021 09:22:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5pgx-0005sV-9d for help-gnu-emacs@gnu.org; Tue, 20 Jul 2021 09:21:47 -0400 Original-Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:35398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5pgv-0006RV-IC for help-gnu-emacs@gnu.org; Tue, 20 Jul 2021 09:21:47 -0400 Original-Received: by mail-lf1-x133.google.com with SMTP id i5so35777133lfe.2 for ; Tue, 20 Jul 2021 06:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S2t0CMBbJFcnGOXACl5jb7CQPoIu8pPObOPY+rzJAFk=; b=LtALVmxQ6KNyVnbjQ+/WyuOCQXwGRSmzRwcSfjel6vcKSoHn3ro1Cbrml7ptqsurG0 dJrVKX2uKdpfZDfdBrhEVnNCzvSsbgf0jAtFzHhefCWtmeH+MdoKBvROTx5OIuHilL+u 9mpw3H1P1BWO/M1QBWp9sA8aL579GYlRGSbRVldhd/VBhhUYQHMoCmyXNLPFNLZMW3Cx iJtNG7wbUdahPjx8s7ueLqzBB4sJ36Ju5rVO9NiSjnNQWqsucRyUtcxGJwJTl4FihcMO eRaxXb+Kf/A68cT0hgFXIq291EoApzi61RgHOfSBll+HdpkWg3AG+0mYwp0Yq7ECbLm8 0nyg== 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=S2t0CMBbJFcnGOXACl5jb7CQPoIu8pPObOPY+rzJAFk=; b=WEb1tmzIxpbu9xNgq6qF+uk9hePEiYk8KZC/9nqV9ZaQ6R4ZN3yL5yqOvcOz2FGfXS QjqcSmNFl5V+/HSIgIZF5Gmw6Z3TELr8PMFIffoMq93Nlx6Q5fTOX4Tm3LBGBcK6gOzq sF0m0d/gSbVCWPnYTh0mpiw6iU59idvhKwwU1iRXzp7di4Sr2jgjWoTrJEeHw2we52Fv lMmPR/ZARq/PuXFY9WrYnxNhfltz2aEQ+CTJ7LdsBlyX7mt/RgkShhlrnSfwkQh9EKGB lhpBSXeRU81Bh7gySxAl1CNHXf81An/OEWDEXTBxDt/FPTW23NlpvgaI9qqZqThqZjNW dxew== X-Gm-Message-State: AOAM530c33ZJWI+TlgDgbBSpwNnNqH5d+0pEqPt0mUu0veuEZZQ59DrS D6bWZI/lPAusf2KvSekpii0lYvBd61BoQgG8XpEW0F/D9ddei1GXhy4= X-Google-Smtp-Source: ABdhPJzNXzn2/zU6l8f2l4XRr3XFc/K/ZMRbEqUZsSgZQSnWi9w18b1oc7epq9suwQeUUVGnGM1PuNN+gALeSXmD9aM= X-Received: by 2002:a05:6512:3f9a:: with SMTP id x26mr22933388lfa.75.1626787303641; Tue, 20 Jul 2021 06:21:43 -0700 (PDT) In-Reply-To: <20210720124903.GA9052@tuxteam.de> Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=hongyi.zhao@gmail.com; helo=mail-lf1-x133.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-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:131873 Archived-At: On Tue, Jul 20, 2021 at 8:49 PM wrote: > > On Tue, Jul 20, 2021 at 07:12:14PM +0800, Hongyi Zhao wrote: > > I adapted the examples given on > > > > to the following: > > > > ;;; > > (setq colors '(("rose merry" . red) (lily (belladonna . yellow)))) > > > > (let-alist colors > > (if (eq ."rose merry" 'red) > > .lily.belladonna)) > > ;;; > > > > When I try to evaluate the above code snippet, the following error is triggered: > > It's not the space. It's the dot ".". This is wrong Lisp syntax: > > (eq ."rose merry" 'red) > > Also the dots in .lily.belladonna look strange. This will be the next > syntax error. > > BTW., if you take the dot out, like so > > (eq "rose merry" 'red) The dot syntax is described on , as follows: Macro: let-alist alist body Creates a binding for each symbol used as keys the association list alist, prefixed with dot. This can be useful when accessing several items in the same association list > the syntax will be correct, but the expression itself won't make much > sense, because it will always be false. The string "rose merry" can't > ever be `eq' to the symbol 'red. > > What are you trying to achieve? I don't want to compare the string "rose merry" and red, instead, the purpose is to extract the value whose key is "rose merry", and then compare the result with 'red, just as the example given on does, i.e., I want to mimic the following one: (setq colors '((rose . red) (lily (belladonna . yellow) (brindisi . pink)))) (let-alist colors (if (eq .rose 'red) .lily.belladonna)) => yellow But in my case, I changed the key 'rose to "rose merry" which triggered the error discussed here. Regards - HY