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 21:25:44 +0000 Message-ID: References: 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="36011"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tomas@tuxteam.de, 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 23:26:27 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 1sqfiM-0009DR-Qu for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 17 Sep 2024 23:26:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqfht-0001CQ-8j; Tue, 17 Sep 2024 17:25:57 -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 1sqfhr-0001C3-Iy for help-gnu-emacs@gnu.org; Tue, 17 Sep 2024 17:25:55 -0400 Original-Received: from mail-4027.protonmail.ch ([185.70.40.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqfho-0001ln-Ei for help-gnu-emacs@gnu.org; Tue, 17 Sep 2024 17:25:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1726608349; x=1726867549; bh=gskfqcWxTjdyVpSyJrfyJw4Dej3e6SqcJt2HHFqmG1k=; 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=cl7D9qLUSc6Dj0/o0bwU2+G6/pOfdqUi16ulLBluCNM7GHH/qIj0WnKSfK5Wy/WHq FAtCSTwX0v+bPYUzsE5sJ8exMM+x9S9HjKtOhHtkVvSim4t/k5ZuGqh6mF0zIY0ZfR 3AcmFTEGMTxFPBbQ8rsAIa3XPqBim8c9pDbAhKcEjCYhTphtOxJwGImjh2K9Dn2O5t x6qYpQHmSZ8VFnLI9xpIlnDNiLANifqnfOlYpCvYd7/VA4pCvCUnY0bfFgVkkXgyF7 h4zVB8pH95TzIFOajuxBZ95FtIvVyDYk6uuWhG9QMs+1FI4Cgo+ZYelYz5k+gQuDwt HEEsFGFUWV2YA== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: d7dda229a7091efc2bc405d6b059db17b85a6a2e Received-SPF: pass client-ip=185.70.40.27; envelope-from=heimeborgia@protonmail.com; helo=mail-4027.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, TO_EQ_FM_DIRECT_MX=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:148019 Archived-At: Sent with Proton Mail secure email. On Wednesday, September 18th, 2024 at 9:02 AM, Heime wrote: >=20 >=20 >=20 >=20 >=20 > Sent with Proton Mail secure email. >=20 >=20 > On Wednesday, September 18th, 2024 at 7:35 AM, tomas@tuxteam.de tomas@tux= team.de wrote: >=20 > > On Tue, Sep 17, 2024 at 07:20:22PM +0000, Heime wrote: > >=20 > > > On Wednesday, September 18th, 2024 at 6:28 AM, tomas@tuxteam.de tomas= @tuxteam.de wrote: > > >=20 > > > > On Tue, Sep 17, 2024 at 06:04:41PM +0000, Heime wrote: > > > >=20 > > > > > On Wednesday, September 18th, 2024 at 5:57 AM, tomas@tuxteam.de t= omas@tuxteam.de wrote: > > > >=20 > > > > > > [...] as an exercise for the reader. > > > > >=20 > > > > > (cl-every #'consp '((foo . bar) nil (baz . quux))) > > > >=20 > > > > Yes. > > > > -- > > > > t > > >=20 > > > Have done this small test, and even though there is a nil (or anythin= g > > > else, e.g. jarod), assoc still works on the other keys. > >=20 > > That's what I was saying (and what Elisp's doc, which is recommended > > reading also says). There are different views on that, and Elisp > > itself is one of the less strict: it just ignores list elements which > > aren't assocs. > >=20 > > There is some historical background to that. "Classical" Lisp "types" > > are just defined by the operations defined on them. > >=20 > > Cheers > > -- > > t >=20 >=20 > After changing to the following, I am getting validation for list > element (1 2 3), even though it is not an association. >=20 > (defun torium-alist-p (obj) > "Return t if object OBJ is an association list (alist)." > (and (listp obj) > (cl-every (lambda (x) #'consp) obj))) I remember. No requirements of lambda to run #'consp on obj Thus, again (defun torium-alist-p (obj) "Return t if object OBJ is an association list (alist)." (and (listp obj) (cl-every #'consp obj)))