From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime Newsgroups: gmane.emacs.help Subject: Re: Check whether an object is an alist Date: Tue, 17 Sep 2024 16:26:19 +0000 Message-ID: References: <87wmjamxg9.fsf@ledu-giraud.fr> <5ta65eMG2v0q4BbBDFQ5D7JUEXbXaBCpR3DOxm2lsGJpx-9k04kvX-UFtQTaKRvUEK6Pi7vP2q_0JrADs7MB8JIL4jzAZFEQHQf1enrBLtM=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29831"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 17 18:27:21 2024 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 1sqb2u-0007XW-Sw for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 17 Sep 2024 18:27:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqb2M-0005LN-Vo; Tue, 17 Sep 2024 12:26:47 -0400 Original-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 1sqb23-0005Hk-A7 for help-gnu-emacs@gnu.org; Tue, 17 Sep 2024 12:26:35 -0400 Original-Received: from mail-4325.protonmail.ch ([185.70.43.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqb21-0007B4-Mf for help-gnu-emacs@gnu.org; Tue, 17 Sep 2024 12:26:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1726590383; x=1726849583; bh=3Fry5AhHImyI7nVVuILTiIiLmi3f/jsrPLmWpkqjBTA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=whaSMjF9VcSpVseeCvEOmxF4VvUm1bEXbqrV4xZTNTsWvrz6wkkSvSNb35QTs8KfI qeNjk1/kWG7kwqkk0GEJp7wKcOCrC4EhLbrZ/XbARQlQQVHp2Wc/MewUtGTvSsEK/2 Z/j05nekmnW/e1xtnkBCaxwxbC9Cp9Uqi+GALIiLFRXaBVOXY+BwBelkDhPONjcQAu uxrpNNm2zvHzwKDOtaa8INs0P0JGdXfSKj3KRsS+rYAkBkCn493wqT8WIUHQhUszhI ojTSpMcngum5lMeCYqQhnSg22LqJIIeN3a6IbvKj/i2Ckkle7ngR3WE1N0o02YLbhh NMferRB5u0/GA== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: a441e7562eba90bc087402b743a030614cf245f8 Received-SPF: pass client-ip=185.70.43.25; envelope-from=heimeborgia@protonmail.com; helo=mail-4325.protonmail.ch 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148009 Archived-At: On Wednesday, September 18th, 2024 at 3:20 AM, tomas@tuxteam.de wrote: > On Tue, Sep 17, 2024 at 02:32:33PM +0000, Heime wrote: >=20 > [...] >=20 > > But taking in consideration what others have been saying here about ali= sts, I > > decided to be more flexible and allow empty alists and keys with nil. T= hen > > (null x) should not be there because it allows nil non-pairs. >=20 >=20 > OK. >=20 > > This is what I am trying to do with > >=20 > > (defun torium-alist-p (obj) > > "Return t if object OBJ is an association list (alist). An alist > > can be empty and nil can act as a key." > > (and (listp obj) > > (every (lambda (x) > > (or (null x) ;; <=3D=3D so this one goes out? > > (consp x))) > > obj))) >=20 >=20 > Cheers > -- > t Is (null x) the part that allows nil, a non-pair object ?