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: pcase without code duplication Date: Fri, 23 Apr 2021 03:51:16 +0000 Message-ID: References: <877dktel9m.fsf@telefonica.net> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39200"; mail-complaints-to="usenet@ciao.gmane.io" To: =?iso-8859-1?Q?=D3scar_Fuentes?= , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 23 05:51:57 2021 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 1lZmrF-000A6H-8J for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 23 Apr 2021 05:51:57 +0200 Original-Received: from localhost ([::1]:41296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZmrE-0002X5-8c for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 22 Apr 2021 23:51:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZmqj-0002Wv-Sa for help-gnu-emacs@gnu.org; Thu, 22 Apr 2021 23:51:25 -0400 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:42180) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZmqh-0007sj-Rx for help-gnu-emacs@gnu.org; Thu, 22 Apr 2021 23:51:25 -0400 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13N3oiW6170097; Fri, 23 Apr 2021 03:51:18 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-2020-01-29; bh=YMF7hctJgOR/iB3J4aojNdr0u0nlSbDkwlZzRn6PgZA=; b=bpFJVwtrKRjdlQ/tZP/uLYggl5AUANauLqgIUqOdfTtc8aQe2mwFGjQPXsRwHKSBQ4GY zJZosYirB0qq+MzUwGL0Xc6r/2716p0UhYTXji6sX/EieHdK4QdrTVPPXcmp4sao3PdE DY0xbEYBeTkvL3IWB9I/fz6Caoe0Cy8TeCBtrVqIc9XMeplEYz6LOe9OImtxRjJ/DVUw BZyWcZWIU0YC3+63kgkDkvJ7QCfuOtkI/X3KcekQBb8TLffKmu0wT81QzKTK74/Ga2dF y264ZLpZiKyUGpYY/8zyigWMrjRfMnhuOJmzKqHID7HllwiEEb0lsm9tP22/PYln7mY2 BA== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 37yqmnq6pc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Apr 2021 03:51:18 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13N3oCfs055189; Fri, 23 Apr 2021 03:51:17 GMT Original-Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2055.outbound.protection.outlook.com [104.47.36.55]) by userp3030.oracle.com with ESMTP id 383cdsdfmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Apr 2021 03:51:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=clOGNuPzNuLFl/RgiEz99GmG1WzsIG3LPjojnR7oyaz7BvWTMkMctK5Pepu3/l3G88EY148j47kWqNic2QhP696YejRh6IMHB6HbZ4uO4oBFhdi4EwQrt+YdanOuAG9eNB+jRcRt02LE/CW7u9tiV/52YGFHfgsIhMJhRYAl3UlLaFaICNfaJnotYKlVU6WqEHNmY573ASJUgfY55QzZPI/iise/xhFxId8+DGwNdPNJLEKC3aeuhYG371FuDZqTAoO+25/uxELtpveZTNlaWYy9g2099hjaNGPiZ3x+RtroTBE0FA75eGe2wNL3APXKWgxeXj/9z49gqX79ygiGQA== 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-SenderADCheck; bh=YMF7hctJgOR/iB3J4aojNdr0u0nlSbDkwlZzRn6PgZA=; b=Fh/eKmgy1cHZBruSbwrxE7HLlkl0cVw0AZFEo9LriY+gVn/csIdY6tuaJAfjawcmrIGmZPjl5B0G4RnM0lBle0pmN4zNJPP8fPxzS7sD4ap7X9yqhq7xLX/LaIUPQkScq5ascg9z+dCCDWNl7Mw8cBndhcp9+rkFcaBUyW6Lkbphcg5wfoQpg/uQ+ZQC7gFyCx2by+977zmrqXDxu/4gJjZ63oV8S+d2qTS3oWO/CiScdfAeNMmrx6X/RUBkBYEbOLRuzxL0e7yRVXG+Kb6ndnJGQvnTaKvk4PNRmG4EJeAv2cd1ZmPMsUhy1j6vLsIx4Rvn44YCJAeSw/GNG7n8zw== 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=YMF7hctJgOR/iB3J4aojNdr0u0nlSbDkwlZzRn6PgZA=; b=a5jT3GTwOxqIVyAjlaQd/nJpq64Zc9jpuqfRFYp9AmJlRYN2Owk+k+LDmmyffh8z5D+fWCdOd90iVSEOB3lji/u/VBddRcCuuRiYYNVe0k+N3gwe0mHIRVWYmqYXoabm3rcUqHgyykcGA8cA8OfikoLkMfINnob06TNiGvtceHY= Original-Received: from SA2PR10MB4474.namprd10.prod.outlook.com (2603:10b6:806:11b::15) by SN6PR10MB2992.namprd10.prod.outlook.com (2603:10b6:805:d7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.20; Fri, 23 Apr 2021 03:51:16 +0000 Original-Received: from SA2PR10MB4474.namprd10.prod.outlook.com ([fe80::2109:9725:fd4a:6494]) by SA2PR10MB4474.namprd10.prod.outlook.com ([fe80::2109:9725:fd4a:6494%6]) with mapi id 15.20.4065.021; Fri, 23 Apr 2021 03:51:16 +0000 Thread-Topic: [External] : Re: pcase without code duplication Thread-Index: AQHXN/AnZLdifQXEG0m7SDcyWc+q3arBdnSQ In-Reply-To: <877dktel9m.fsf@telefonica.net> Accept-Language: en-US Content-Language: en-US authentication-results: wanadoo.es; dkim=none (message not signed) header.d=none;wanadoo.es; dmarc=none action=none header.from=oracle.com; x-originating-ip: [73.170.83.28] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8fbd8766-2087-487c-a9a6-08d9060b0bf8 x-ms-traffictypediagnostic: SN6PR10MB2992: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PRRSr6yFYpWbOJr+wqiZXIoQ1CPdlwjaawPovpdHXWqbxCjt3IN9/2Ca8GdCGztVW8xEjja3ZsGoFAQBD9//Ry6pk28vAzjQeuVoHPh8ls3un9IfLxPQWfuqnzqr33JLdGLWwbq/56Dqr9f3KYzlXRLJyyHGgofBrYEh0ugCa+s0WGr3wEBGhCtg15zQmnOIpz5OOPEa5lfDn0oH4tBPCzIh4VV0FDTuw2W0IO3g+diUc9es0adtmsQp6Kzof5maPijJE18vrV6FI8kBfFs0w4+WvvIqZmqDQWUNizeG6vW90jlvqR29xPARJ2X6ZdFC7DLtTNGFbR4oJhYQxbZ4kT7O1hJU2Rj39ynNqPN+zZA95hBNBYtd6YddbdTjEwq/odTcRkY1wuJdrsmRhM0C71x30zxs08JSyF7aKS5INVCBATMhuktMnJOeHR1RX29u7JxwqCHzDgpbjA+28du/cQiIED+FOqHAxKXNqAWcVcgDv3fXWpBRrcZ1j7BPhNIbvrHVL1k8EujFFIZOFmxou+C1JicLl7pO1wI9O+nnrDzE4TOD2X/VeKq8wtJcnxkWfmVakgCD1dhTOo5b1k/ydt5sBU0FjS56E/FlOSNfpDE= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA2PR10MB4474.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(136003)(376002)(39860400002)(346002)(366004)(66446008)(316002)(38100700002)(66556008)(6506007)(8936002)(55016002)(122000001)(4744005)(76116006)(9686003)(8676002)(66476007)(26005)(71200400001)(7696005)(52536014)(110136005)(64756008)(44832011)(86362001)(33656002)(83380400001)(2906002)(478600001)(5660300002)(66946007)(186003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?PFhdiFOwepCCdAAeeN+ivCSDE0L2QNZAyLC26q7E3t2n0O/rPuFddBFUde?= =?iso-8859-1?Q?BI4I8AsHP6vhVNjfIOKSQTq2SwuGHQpdyN0JyNNv+v+DIjy+HlcthTc+2f?= =?iso-8859-1?Q?pTH0liP/4XxAQTDpFiDnjju6njAqzxZ+Is9C5tiWo1aJIojVaVWOYHM1zw?= =?iso-8859-1?Q?qVB7IAibvud8srJIO+WMPNSMvbu5o5+96NDrr+7R0xHBzCSfbSbFT4K0Xm?= =?iso-8859-1?Q?281UKFyDvsyBLKrrBTvFVLMn7O9HpcZA26OxU8qHBFIz9+moU22ZBZxnzi?= =?iso-8859-1?Q?p9swLYnyt4BZgzsuZRAgCi6h5E0jdoLc8xP2NYrM6gpHlhVJLC81iJrY9q?= =?iso-8859-1?Q?Eebx642ycU1Zv4dKxt/phbHFPz4Y3naUBUsqEpJrnjgVR1EG1JudeGgi2J?= =?iso-8859-1?Q?jhweT0pHO+TILk4/Huka1qc8iHwwFem2pxnHt4A1csYr/lfW4Ec4RcUBpj?= =?iso-8859-1?Q?iCDxCl5ff6p0I5XE/v13cJygTotkyLJhhwgZ7jlBznwGyHzTBvW3Mmk+ei?= =?iso-8859-1?Q?M/iiIEv3FiQylcSm50HROTsSTLVRMEFmtAH4wuCr+r7myYVIfjpeA+JPjL?= =?iso-8859-1?Q?QMyEXCTlu4QpzmqMLse1neruJHQZRTLTvGs00skIzS9RxvOrLlx3FV9cM3?= =?iso-8859-1?Q?v2 x-ms-exchange-transport-forked: True X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4474.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fbd8766-2087-487c-a9a6-08d9060b0bf8 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2021 03:51:16.4082 (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: ynsLg0w4sOCHboTyG+qaapHn5S+gClK48u1rWpDQ+na0d+GN2w6QrErxcP2q92FiF3p6jTE+QLqXCmNc8BrZgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR10MB2992 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9962 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104230023 X-Proofpoint-ORIG-GUID: IA1bj0JE3zgMkXLQ2wLIeYlkulSxJv7S X-Proofpoint-GUID: IA1bj0JE3zgMkXLQ2wLIeYlkulSxJv7S X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9962 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 adultscore=0 impostorscore=0 spamscore=0 malwarescore=0 clxscore=1011 lowpriorityscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104230023 Received-SPF: pass client-ip=141.146.126.78; envelope-from=drew.adams@oracle.com; helo=aserp2120.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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.23 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" Xref: news.gmane.io gmane.emacs.help:129125 Archived-At: > > I am using pcase, but am wondering whether I can have pcase > > for 0 and 2 do the same things without adding a separate pcase > > (0 and duplicating the statements. > > > > (pcase orthogr-region > > (0 ... ) ; same operations as pcase 2 > > (1 ... ) > > (2 ... ) ; operations > > (_ ... ) ) >=20 > (let ((xx 2)) > (pcase xx > (1 (message "one")) > ((or 0 2) (message "zero or two")) > (_ (message "something else")))) And even ordinary cl-case (aka case) will do, if that's all you're doing. (cl-case xx (1 (message "one")) ((0 2) (message "zero or two")) (t (message "something else")))