From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: [External] : Re: Testing whether a list contains at least one non-nil element Date: Tue, 25 Oct 2022 15:59:59 +0000 Message-ID: References: <87pmegm7lk.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36706"; mail-complaints-to="usenet@ciao.gmane.io" To: Michael Heerdegen , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 25 18:06:05 2022 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 1onMRJ-0009JO-Ef for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 25 Oct 2022 18:06:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onMM1-00021n-VC; Tue, 25 Oct 2022 12:00:39 -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 1onMLf-0008LT-18 for help-gnu-emacs@gnu.org; Tue, 25 Oct 2022 12:00:15 -0400 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onMLa-0002pX-Ar for help-gnu-emacs@gnu.org; Tue, 25 Oct 2022 12:00:14 -0400 Original-Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29PFUV9O007931; Tue, 25 Oct 2022 16:00:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=ui4eLZquOJLevjoIVLn54+DkJpcVgsweY02SVaGSkZ8=; b=Gacl090mb7ldlcEN0Jg9P5GnQ5FhNN1Bvc7x31HdL1U6P2r4IJnXJVKeYCH2nz2dkHT7 UVCS3FjY8IMcamDnnhAAQ6ufyIyM+BabsCuOdzCxekvDqn/p5MAy8jm8l4zX9dwIJjth 6t0svB0e+rORbxHdWqX8EyU2VRpOOCOcbV6xtD5JhPVSXgpk2C/uAqkBzO9aDMpbvC0f B9Rx4RNlzoMW+ynXlFokh8k5DJjbhGhhFlJlN5+evJxGN1ozxfabnesYubqbF8ANWaCC 8W8hvNcfNyOWO8jbFoZi17He6zq1IIe47sOsmTHIttpqvU0LEKoO9HtrLFIxQitZa4+n jQ== Original-Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kc6xe3bmx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Oct 2022 16:00:03 +0000 Original-Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29PErcTv034078; Tue, 25 Oct 2022 16:00:02 GMT Original-Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kc6yajns4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Oct 2022 16:00:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rsh3ac5YBAoZqYe6XwWwROZFZ3Z45mFrKG+7AnybEQNdYStd4VlbX+CXrxgAfWE3OeZG/ss+nkODYpZ+gwb89UXcrVHPwewG9yPTEYdJ7YPmTFCdIxSGp46TjrDKFnHEWYI3nlyLfBQvLFUKQoq3gsqOJLboHQeJMfHNjiw7mHNTywjcD99qoJQ7I827fj39gzwjkNP2sS+xRRp0X6TyCA8eVZ9T6exoukqhgrfUtNOaaqBAzEJojnXUuufAUfQYp2simJoZKh0JkcOZKnj3F883znnaylFn7YILoY96iZewLup4hfMCHT7UxyJh/WnroygY5c0ff8VTDUoKATdktw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ui4eLZquOJLevjoIVLn54+DkJpcVgsweY02SVaGSkZ8=; b=FrdDN1A40neMMk2c0Ir/gOSNkakKXRnyIpowxZcJydHzodpQPfFDXLfEs0s7aXXzy3IDhRwUKsiDciibegyt1kgcRq3eJqfFcnSzsArqBjGtySL/NWHwCSgpnWpOi3V2TQHHJPdYiq3WzEAwc1SQeLkuuiqqC5V7/CQnwPuDREfAWJg27bg8YcUvPuUxLxQkR+mY0idiafGRN1jQfHXSS+Zg0R6fTmNgiOIzGraQjQjF+z+obgjH/biXsRZk3Xs2/QLyfKwb7bN8jatV1hcBXQ/SiG/x7s3z+oMCZ5Gj6AIPqs0kiqDQlTtaiXzq7HnUKU3HlN78XIue/DjM9af4qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ui4eLZquOJLevjoIVLn54+DkJpcVgsweY02SVaGSkZ8=; b=fWPmdFGEU+0fkxRXtjS3B5obdRYQoPEm6fDIox+g7ay4q9dWcJ+RDsL1FWTS/LFj50/1ExyxUW0CGzoLdHyiUZr/zynqcMNglmJ4EXRku3kfln+qDmjwdcLiC9+g3G5yfsUSbxmo01lf+1cdVCYksKlBSd+UDRthOYISRJsDOkM= Original-Received: from CO6PR10MB5473.namprd10.prod.outlook.com (2603:10b6:5:355::21) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Tue, 25 Oct 2022 16:00:00 +0000 Original-Received: from CO6PR10MB5473.namprd10.prod.outlook.com ([fe80::1a88:dbc:8980:350c]) by CO6PR10MB5473.namprd10.prod.outlook.com ([fe80::1a88:dbc:8980:350c%9]) with mapi id 15.20.5746.028; Tue, 25 Oct 2022 15:59:59 +0000 Thread-Topic: [External] : Re: Testing whether a list contains at least one non-nil element Thread-Index: AQHY6GqblZwCJC2S6EObw0jiDWt2F64fQxuA In-Reply-To: <87pmegm7lk.fsf@web.de> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO6PR10MB5473:EE_|BN0PR10MB5351:EE_ x-ms-office365-filtering-correlation-id: 45405b79-68ef-4a03-c53e-08dab6a1f80c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1Z90TVo5LOxYVoFwvus/7rs6+Xm5fS9YOsg6AVFuEasqSljjeSfSd+eu48OGuuZ468egaXRvYDVAI5fJRG2o0+TnJuf9MMNxhWLaOqKlX/VtBfqliMy9UgQPPmTIj2Z3ZjzybG4J4BDkl/vhrkEqvwEJI+LdAEHjVQfA+JMcL0E3ZwfNCSIvwRsNttQe8K5999c0Pf/buXekBRxcEuN0M0qTYfU9T+xccE4Ui7EohRK/UVRBlvAP7CioxzJyj7b/vB54jZJtsKwo/6YkU5T1Clmpv7/G3x5UoUXtx0YCkh4qjnW2lEDDfCY1Jh7ABlobUkli53zu9ovDClVA5F3AXp/94ywDG0mhMpoLsLzZBqB/A6npjNi4mcRErlFqrZw1Ycsi3ACsfseCRMJPSUmSU0sRh0PsprG1fZEn6f7P2xfQc+W7N/clRmM5/D5PDyFpP+4CN5VRfOOQegts1xv4YML9JLpn+/rjhmLhqTNaAxc/IspodsdBE54lzlxpgZuAbBDlnM2aqekb9/JMcGmX6fmVVHkqhQyO/DNNTXuz8bDtYRinp36d5jF4+1SlJ2xRTInBxsnOJ/JvIXLFlL2+GyUOYAIBBcs+y1N18w8Lr5nUhW+TQSsq91T2yuNQrK2VZDVr272WbqqBWdtccjHEj2P84ALN0CfWogaG4kXFuw3gtBnouVx7r6Xuw5sUImo3gkX804Bprs2BdarPgRAg/Y6yHkNiImwvUWOXK+8AVCCp/WqtnZ1IVA3JEVZhD 94nY5oxDvbL9NZQJwCWnteRhw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5473.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(366004)(39860400002)(136003)(396003)(376002)(451199015)(478600001)(71200400001)(66556008)(55016003)(7696005)(33656002)(8676002)(64756008)(6506007)(316002)(110136005)(66446008)(66946007)(86362001)(66476007)(76116006)(41300700001)(38100700002)(26005)(9686003)(52536014)(8936002)(186003)(4744005)(5660300002)(38070700005)(44832011)(122000001)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hDyJCrZ3mS+aOLQOoGfiewEv9Lj4MLiF/rqicR3DQuqZ1WJtQG4gB1fwoPZn?= =?us-ascii?Q?lTno15Sc63h5QImWWcRco+QOakidImC1Tgr6p147H5PlvB55OdvT7okzG0YH?= =?us-ascii?Q?QIp+v9ocT4OOoRXFy1emXdiPl8OOfeXYQVXs5TD6ox6zEGBg9MSzDey4xqZQ?= =?us-ascii?Q?Q9ju2X8nj1KgJXFV53t03kHmg7rh8baR9ZhJTEwV9Jgb01MI8BWD/6K1Z/9e?= =?us-ascii?Q?6vrGPInmgZ1LokrRFe2ejVV0Nya6Swk0NhGugRXQxRHANKP8AwX5UGzmTr3r?= =?us-ascii?Q?rNI2POrK9yd2oD6nwI+zz1yyzEQwW9JYC6U2BEASo8Me16xUuch+w3d6jH8V?= =?us-ascii?Q?zmS3zPCsNHEcTl5HL/+kFQq5/doA2umAsNDnHKTIjGpoj3U8j/9BVcwraYa+?= =?us-ascii?Q?LSWuGgqEbaxoRC+kRjoQ1GTCLsBmSpp1ydBjrmOudnn1vif5ElcSNXPy+2Mv?= =?us-ascii?Q?rMGLsIUZV7OcbQNvn4GNTYQMVqApUzCUA2QVtDfi5OJWPipozjUkcMztPRvR?= =?us-ascii?Q?NUNECrcKLErPaZEELEi517eN4OlkjJF3nQ0cjH9WE/9avoFEQRFcqALQ3spR?= =?us-ascii?Q?BJfgbZwRpXlNSay6nYP8yqPprFh5+K9VpyUQST/ocLFJ8norSD8vXjKSlOk6?= =?us-ascii?Q?uF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5473.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45405b79-68ef-4a03-c53e-08dab6a1f80c X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Oct 2022 15:59:59.3297 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KSGHifs/stwAK2zyQAULhVrZRUHlhPFaOgiMbl/HTmnXOUiOHeUgnXa258TMJrglrqcBoBsrVDMQ6fyYfyih+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-25_09,2022-10-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=953 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210250090 X-Proofpoint-GUID: PHLzqxqrjbBdvrV2YL8WdGX2YfEZ8Gxc X-Proofpoint-ORIG-GUID: PHLzqxqrjbBdvrV2YL8WdGX2YfEZ8Gxc Received-SPF: pass client-ip=205.220.177.32; envelope-from=drew.adams@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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: , Original-Sender: "help-gnu-emacs" Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140373 Archived-At: > > I would like to test whether a list contains=20 > > at least one non-nil element? >=20 > I'd use `cl-some': (cl-some #'identity my-list). > There are lots of other possible solutions, like > using a simple `while' loop or a `dolist' with > `catch' and `throw'. IOW: (setq toto '(nil nil 3 nil nil)) (defun foo (xs) (while (and (not (car xs)) xs) (setq xs (cdr xs))) (car xs)) (defun bar (xs) (catch 'bar (dolist (x xs) (when x (throw 'bar t))) nil)) (foo toto) (bar toto) Or just: (cl-member-if-not #'null toto)