From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Check whether an object is an alist Date: Tue, 17 Sep 2024 11:38:46 +0200 Message-ID: <87wmjamxg9.fsf@ledu-giraud.fr> References: Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28714"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 17 11:39:31 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 1sqUgE-0007Fm-Da for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 17 Sep 2024 11:39:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqUfe-00048B-29; Tue, 17 Sep 2024 05:38:54 -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 1sqUfc-000481-Kt for help-gnu-emacs@gnu.org; Tue, 17 Sep 2024 05:38:52 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqUfa-0006Rw-UU for help-gnu-emacs@gnu.org; Tue, 17 Sep 2024 05:38:52 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=slBmNNz1 tMo8FHvPUmBtM5ELP5mtBG8jN1jwD/Ys7BE=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=PQYR4SoKiQdM28QYqnGYDXH8HoUgw0 lXxPD9Xp4xEthKQGvtqqLrkmAlOIWt3Q1C5v6WHxq9iqiRBFeHxJkwDg== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=slBmNNz1tMo8FHvP UmBtM5ELP5mtBG8jN1jwD/Ys7BE=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=a+UrzvjftAX6v777m4lWrUWi7vlY2nHSIZYQTm N6ApSv0AMjzxnpTclVNbbmwrFkhw1WLK6+1QH0G7yzGQHsAmlYVH7ZKx09NmbCQBSWwgG3 WPaYsXv13U3jgp98mnevJ98k4+69DlwHoSE+NlTh7R5UB7VjdpWuyT5QT8ljUiTk8eSySb /NCw/bkVqwye7JbTqEkD6ieNkkMbMQTbJJwQPY0NHmSnChiqIylGm4Vhee9iIqvFcZmQjT oCAxX1CaClCDlbUctAoAAfHpD7JOhwncldwlxvdL+k/fVFJBCqQ4iKYP7eRZWPO65SdNk+ m357WDnsEtNW3ekpTihb3vTg== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 6511509a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 17 Sep 2024 11:38:47 +0200 (CEST) In-Reply-To: (Heime's message of "Tue, 17 Sep 2024 08:45:54 +0000") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr 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_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:147999 Archived-At: Heime writes: > Sent with Proton Mail secure email. > > On Monday, September 16th, 2024 at 10:29 PM, Heime wrote: > >> Is there a function that checks whether an object is an alist. >> Have only found listp. > > Because I may have to come up with a solution, I have made this one. > Am I missing anything ? > > (defun torium-alist-p (obj) > "Return t if object OBJ is an association list (alist)." > (and (listp obj) > (not (null obj)) > (every (lambda (x) > (and (consp x) > (not (null x)))) > obj))) Looks good to me. I think it should `cl-every' instead of `every' and also, maybe, nil is a valid empty alist. -- Manuel Giraud