From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: Re: Check whether an object is an alist Date: Tue, 17 Sep 2024 15:58:59 +0200 Message-ID: References: <87wmjamxg9.fsf@ledu-giraud.fr> <5ta65eMG2v0q4BbBDFQ5D7JUEXbXaBCpR3DOxm2lsGJpx-9k04kvX-UFtQTaKRvUEK6Pi7vP2q_0JrADs7MB8JIL4jzAZFEQHQf1enrBLtM=@protonmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Flg8DoTVDeN1kvc" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23761"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 17 15:59:35 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 1sqYjv-000633-7E for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 17 Sep 2024 15:59:35 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqYjU-0005sC-Vh; Tue, 17 Sep 2024 09:59:09 -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 1sqYjQ-0005rj-Am for help-gnu-emacs@gnu.org; Tue, 17 Sep 2024 09:59:05 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqYjO-0005jT-EC for help-gnu-emacs@gnu.org; Tue, 17 Sep 2024 09:59:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject :Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=MlP+2S41IRZUTlumoALciUxitzA5Efd8fIxMg0QBr6U=; b=A4KrRo8LfmGAnawBlMEMrNeeJf D7r29QTicV4z91ZpSoN852zINexYRJsNmfiubOeo9ETJwrXrN1zgiF//tn9vruTFM8/kOvBGzWOFJ GZItXMJnZWFqq02guM2ejWhQRCVXH0Cohy9KIbpHchL43+wBBBomIxaB8Gu4v7vVkmT0HHAB/7PRx D+Y53O4lTDz+ma/i2a0skUFDVc/MlMUV0FRTIhMODdX6BOUraBCQOdIB9OmagEQlc3OXloM10JCPV 6yW79jMQIzE9j1V1cMC8EuowOa+DsKxxD1PH5Fl64WcodJ+pgMFJTcM8sC+KV+86PGYwTRuUdyMY9 sheY+6wg==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1sqYjL-000592-9h; Tue, 17 Sep 2024 15:58:59 +0200 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de 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, 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.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:148005 Archived-At: --4Flg8DoTVDeN1kvc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 17, 2024 at 01:51:54PM +0000, Heime wrote: [...] > Have modified the code to this >=20 > (defun torium-alist-p (obj) > "Return t if object OBJ is an association list (alist)." > (and (listp obj) > (every (lambda (x) > (or (null x) > (consp x))) > obj))) >=20 > I want to allow empty lists and empty keys. Or should I remove (null x) > as well ? That depends on how strict you want to be. Have you read elisp's docs on association lists? Elisp tends to tolerate alists whose elements are not pairs. Other Lisps are stricter. Your function is a funny in-between (nil non-pairs are OK, but others are not). First try to understand what you are trying to do, then do. Note that, contrary to hashes, alists are not strictly defined. Cheers --=20 t --4Flg8DoTVDeN1kvc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZumLFQAKCRAFyCz1etHa RoWLAJ9vaRnNvhS7e5MhHB2gtxmPTd8x3ACfTmG1d+abHFusXCwa1k3oS8fhUy0= =GbTi -----END PGP SIGNATURE----- --4Flg8DoTVDeN1kvc--