From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: cond* vs pcase Date: Wed, 07 Feb 2024 13:43:30 +0100 Message-ID: References: <87il32iwmm.fsf@posteo.net> <87o7cttu4l.fsf@posteo.net> <87o7cts9nc.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38221"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Philip Kaludercic , "Alfred M. Szmidt" , emacs-devel@gnu.org To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 07 14:18:56 2024 Return-path: Envelope-to: ged-emacs-devel@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 1rXhpF-0009fe-Qg for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Feb 2024 14:18:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXhoS-0006dt-FW; Wed, 07 Feb 2024 08:18:04 -0500 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 1rXhH9-0006WX-KJ for emacs-devel@gnu.org; Wed, 07 Feb 2024 07:43:39 -0500 Original-Received: from mail-am6eur05olkn2095.outbound.protection.outlook.com ([40.92.91.95] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXhH6-0003T2-3b; Wed, 07 Feb 2024 07:43:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tc3wRAnKLHMl57LbqSrA2/rD2KtzETzFdz/qeky0YsqvBvW3L2nTdHSmzFUP40IuFSZY+q9c1TrJYH9HNiVbanbdR4Ru/DMU+hvVtPiMdTEqDyKkIOJHkaDwCPn6p/yGsPcPI/P72N6XJXTiAH1tDybWTrrdFQ7hmcuCHeJB1HYoNAs5DmsHSnxBWVN+bPVU19fDq3yWxexQCIiZ8X+i1/bD7xrwqkC0LGg7d8RHFgwvOweV5eGoJhNAx/Bnz+tEcHS+NE4kMActiJYXyOfHcifj9Qcv2eObEsNxWuoJ9yrmlHcTYOvJIx09oG8YI3Cti4IUoInyphAuye30kB+bXw== 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=nrVqPp4xAEkn1h/tx9l83YBGKD6wR8wZmNGRN0LKkpQ=; b=SbQlWGyjReE/lH8IkFXMJ/DzEXKyr8CVtHCJ1P77m3x9u5BYqCZiQmjrvQDdwW0GkSK4oC7HCGmLV1AASqDZPyGFZ+r6AzcA8/iSybb0BaDwCGtcSGqYw/BFxOnz/vanfeQF0zmvUaD7sl7sMS/rzv7kBzQS27hy5luo7MzYfBC7wf6/m8JS/QtRR113RkqZRsM+vNImya1C1FuCaEElWuB4GlVXhE/3cRMrI0QdpMmgwNhNjrO4d19M4hn/pPWyQVEl0kvKynes15h8f8WkZ4/v4Xi1wrK7kWw4jaFcDu5cKwsZzto+HJ+mSMor3kNRz3c6eCPv7isYxNGwQtihBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nrVqPp4xAEkn1h/tx9l83YBGKD6wR8wZmNGRN0LKkpQ=; b=TiMznisSP8j+QbzB8ZAbkSEa3rrAUbyvZmd5mju4/MOUSVEdGFHo114M/WMvTMuNnL7foIAQi5gM4rrc+U2acABh5MGpArOs8WhGhzpQZ2NThfX56PgV/aydmzSn08dkPi2CjZQaA6XMxOLt81aEiEDwa1vO95LlOGgjhdkun5Mr6JVSziRi6UkzdzSk0svTJGISwncEWvmIcuKwTDbKRhbX8224kQ24L9TMlxaAqKM0Zp+mZXu+YnaQHdFlMeM925EL6lNJkBBLiuNTttUIl6uXn3UW+0PP6Me9jtxqTjeHqS/OL9hDRNwj172bK4bpG3QcRw9E4MNh/l23wFfNfg== Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) by GV2PR02MB8674.eurprd02.prod.outlook.com (2603:10a6:150:74::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36; Wed, 7 Feb 2024 12:43:32 +0000 Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::b91:5e3:fb4a:3b2c]) by DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::b91:5e3:fb4a:3b2c%3]) with mapi id 15.20.7249.035; Wed, 7 Feb 2024 12:43:32 +0000 In-Reply-To: (Yuri Khan's message of "Wed, 7 Feb 2024 12:32:25 +0700") X-TMN: [mX0sKb7Mj1eyObnTzCoMZ9Cns7zydvegv0XUgEFoHrk=] X-ClientProxiedBy: MM0P280CA0017.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:a::6) To DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) X-Microsoft-Original-Message-ID: <871q9otpfx.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR02MB10109:EE_|GV2PR02MB8674:EE_ X-MS-Office365-Filtering-Correlation-Id: f4191b11-7524-4e75-e0ac-08dc27da6416 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ibd5dU+V0ggFytgMQASDs7ZpByUQx+62eBk+tS4mUCtdx3AW5BUh6k1XRJwTmtD2LpBhB+X0LmhIuWdsbo6OogOORmA4/UpgE0mIzCfH7ZAMzbTklxGzpUtBb5Z7opD4+bxpIo23VUNCqw+CuytG0Onnw3k4U53Svzm2ZkWO1n9f0ICrEn8tAqLbCD0NpKmQiBqswXvjEs21OnMav2E59fjx/HMHEbjdm1g5yl1+PG1pPt7IgM/zMlsQ68pKDxyEeWOIXDChd2elYvn4fyWfXxkXYrSoJ0w9ZN7ASvY7SlDCc9D1UuGeId7OL635YVfS49tjUecMdR/0YlprnEPVoUD9v+zW+e2rFwjjsD/5uqNXx1jVd5PTIGCKmwUrpmlv57PZskKyOBEd1KzA1ZUWtb21bTZ++5igILvn9hITII3trQFG4h2TMLIQq2b4XP0ghgK6fs5BxfjchfMdhmYmd+hxuuwKFMyTrRo3q2CuSGu7JSwjENTuHADwy7Sh1MwN6WRTIGl/Nih93W7G8nfV/zH9Wnzw9vWHfE+DcyKQ32N2G7AH/GH3P3WLVFIhBsMVsRorrYUS1Z6+FCcc1FJ1W3C6YvczMeF9pjAWAIZ+jwI= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uL88/3RlN5AqdE61zS+hUaHzBGaI1jmZq98KVmrBBQXvhxgU3wySe8gcVnO3?= =?us-ascii?Q?McowscSP6sNFsa7Jkr0dO+fi0fN0jw0WHUoypsKg8+CdPW9U1c7qQswlPSHu?= =?us-ascii?Q?mGbq/DpI8no76SwJiuDnOJaFbKw2J4+SwLai5Xeb4r8FYvRNjZx3+amm/TbY?= =?us-ascii?Q?rsdN7Zz6yMxpcrpo3we10d5WzmY+XzvDrZOsIf3r0yEZYi980RhJkn258UW1?= =?us-ascii?Q?YUFykCfiBoQ8u9pVVfMDoQR/7HV1LjOjT5r9wU+R5YpCfTq3SMVufYPSEl72?= =?us-ascii?Q?ZHQdUmQ8+ncGPkwd2fPBOzJkhnS0YG22HAlJMRoH79l2tdsXGJRW0nd48WCF?= =?us-ascii?Q?M5fIUCBuxHbdiZNQxXOUKnoHKN6fD/xYHf+RqgSEnfwv/h2DQQaQ3b1pEB/P?= =?us-ascii?Q?rzOh6BMfztjKecEDA929CMhJwrGvEkz0JH4Jw9WU8up/hJ1qh4RJD6OU2eY/?= =?us-ascii?Q?3V/awNDgBy5+Z9n9HbmR3V9QGVTCAHjqaMNC6HbJnEzCSNTYhP/sTyyJWwgu?= =?us-ascii?Q?c1bfombQZUcWIV8om+Vo1fK/PvT6o6/R2GOwzk24wYvvuFeysOFuSmsamqZG?= =?us-ascii?Q?Ici/0RiWyvIQw944gLXQIoSo9TsBKSZ+ZgO+NeS80MQT3Kns1R6Nb6lchTwO?= =?us-ascii?Q?7n X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-ab7de.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: f4191b11-7524-4e75-e0ac-08dc27da6416 X-MS-Exchange-CrossTenant-AuthSource: DU2PR02MB10109.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2024 12:43:31.9980 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR02MB8674 Received-SPF: pass client-ip=40.92.91.95; envelope-from=arthur.miller@live.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com 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_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 07 Feb 2024 08:18:02 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315973 Archived-At: Yuri Khan writes: > On Wed, 7 Feb 2024 at 01:58, Philip Kaludercic wrote: > >> Please don't be dishonest; My question was why cl-case was more >> appropriate than pcase, where both are macros that boil down to simpler >> primitives. > > The design principle that Alfred alludes to is known as the [Rule of > Least Power][0]. That advocates using the least powerful construct > that still does the job. Like specialized mapcar instead of a > general-purpose while loop, or an http client instead of coding > directly against tcp sockets. > > [0]: https://en.wikipedia.org/wiki/Rule_of_least_power I think it is a bad application of this principle in this context. Sitting an deciding if there is a less-powerful condition form, or mapping functon for the job sounds to me like a peep-hole optimization of Lisp, and as Monnier said once, without benefit of the additional speed. Before someone pulls out "eval"; that would be a completely different case, pun intended. I am not sure if Alfred meant that in his first message, perhaps he did, but Drew seems to be more in line with that thinking. At least I understand him so. If we going to have guiding principles that help us construct our programs, in my opinion PAIP book by P. Norvig has few good advices: * Be specific. * Use abstractions. * Be concise. * Use the provided tools. * Don't be obscure. * Be consistent. He sas: "Sometimes, however, the maxims are in conflict, and experience will tell you which one to prefer." Than comes the example with push vs setf, with reasoning about both, which he finnishes with following advice: "Whichever choice you make on such issues, remember the sixth maxim: be consistent." Which I think is the most relevant for this discussion. https://norvig.github.io/paip-lisp/#/chapter3 (It is Free to read and put online by the author himself.)