From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: What's the canonical way to check "alistp"? Date: Thu, 1 Mar 2018 09:06:21 -0800 (PST) Message-ID: <5392b397-4974-42cd-9328-161ba7f72f2f@default> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1519924476 3496 195.159.176.226 (1 Mar 2018 17:14:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Mar 2018 17:14:36 +0000 (UTC) To: Kaushal Modi , Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 01 18:14:31 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1erRmp-0000Tt-7n for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Mar 2018 18:14:31 +0100 Original-Received: from localhost ([::1]:58394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erRor-0005PC-QM for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Mar 2018 12:16:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erRi2-0000df-Qp for help-gnu-emacs@gnu.org; Thu, 01 Mar 2018 12:09:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erRi0-0008HI-6G for help-gnu-emacs@gnu.org; Thu, 01 Mar 2018 12:09:34 -0500 Original-Received: from userp2130.oracle.com ([156.151.31.86]:46734) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erRhz-0008GM-RY for help-gnu-emacs@gnu.org; Thu, 01 Mar 2018 12:09:32 -0500 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w21H26HL135988; Thu, 1 Mar 2018 17:09:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=udd+Dm+59Xb+GmkZvXBMaDwK6C3HJzV4tSPobSgz/uM=; b=CoDu7NFOok3SaDy1uryhp449RpfOCcwRRq1AHBvHc8/Mww6oVr/nxZWuwb268RHOHF0h AhuyXEUyD8HJXrSqs7fbbDmiz/91oYY6yz93mECISHPWb3vufxzrVcAmkm4lHHfOQ5ZH y20iJGrVRe8dKIfDB8K4z9POUhZcwi3XMCvvrnCp8Me73Cvp7NQ19e5lCOh1+SfeZdd6 F9C9bOFdOYELIBwGF9QsbEPC5Ej0S4rFD3bFnE415HMDiE3n3JzfK3czI0pkiiqr6NQt kma9E1HzQ2Y+LAl/ZAYnDUhnVYQ3q+UVbb+kIeO7esfRTJgo7puI6in54K+uooN6F/uL WQ== Original-Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2genhp0368-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Mar 2018 17:09:17 +0000 Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w21H6NFo005106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Mar 2018 17:06:23 GMT Original-Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w21H6Ncp027443; Thu, 1 Mar 2018 17:06:23 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4654.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8819 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=750 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803010212 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116103 Archived-At: > What's the best way to check if every element in a list is also a list? Also a _list_ or also a cons? Do you want (alistp '(())) to return true? I'm guessing no. (defun alistp (xs) "Return non-nil iff XS is a list and each element is a cons." (and (listp xs) (catch 'alistp (dolist (x xs) (unless (consp x) (throw 'alistp nil))) t))) (The code should not bother to check each element if it finds one that is not a cons.)