From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Advantage using mapc over dolist Date: Tue, 3 Dec 2024 22:38:53 +0300 Message-ID: References: <87zflevbwm.fsf@neko.mail-host-address-is-not-set> <87h67ku813.fsf@neko.mail-host-address-is-not-set> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34652"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.2.12 (2023-09-09) Cc: Stefan Monnier , help-gnu-emacs@gnu.org To: Tomas Hlavaty Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 03 20:44:37 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 1tIYp2-0008lw-Uy for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 03 Dec 2024 20:44:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIYoP-0001j9-3i; Tue, 03 Dec 2024 14:43:57 -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 1tIYoN-0001if-E3 for help-gnu-emacs@gnu.org; Tue, 03 Dec 2024 14:43:55 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIYoK-0005SY-Lf for help-gnu-emacs@gnu.org; Tue, 03 Dec 2024 14:43:54 -0500 Original-Received: from localhost ([::ffff:41.75.174.232]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000081F0A.00000000674F5F76.003591BA; Tue, 03 Dec 2024 12:43:49 -0700 Mail-Followup-To: Tomas Hlavaty , Stefan Monnier , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <87h67ku813.fsf@neko.mail-host-address-is-not-set> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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.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:148559 Archived-At: * Tomas Hlavaty [2024-12-03 18:01]: > On Tue 03 Dec 2024 at 09:11, Stefan Monnier via Users list for the GNU Emacs text editor wrote: > >>> (pcase actm > >>> ('armg (do-this)) > >>> ('go (do-that)))) > >> > >> this does not justify pcase, use ecase or case instead > > > > That's your personal preference. > > My own personal preference is to forget about > > case/cl/case/ecase/cl-ecase and just use `pcase` like the author > > already did. > > I respect your preference and understand that you as pcase author would > prefer it everywhere. But whoever renamed case and ecase did not > respect other peoples preferences and people are now forced to use that > pcase monstrosity even in very simple cases. No infection here, no monstrosity on my side, and nobody forced me anything, in fact I have highest joy with Emacs Lisp. I remember `dlet*' was like this: (defmacro rcd-dlet (binders &rest body) "Like `let*' but using dynamic scoping. Argument BINDERS behaves similarly like `let' with the difference that variables become global even under lexical scope. Optional argument BODY will be executed." (declare (indent 1) (debug let)) ;; (defvar FOO) only affects the current scope, but in order for ;; this not to affect code after the main `let' we need to create a new scope, ;; which is what the surrounding `let' is for. ;; FIXME: (let () ...) currently doesn't actually create a new scope, ;; which is why we use (let (_) ...). `(let (_) ,@(mapcar (lambda (binder) `(defvar ,(if (consp binder) (car binder) binder))) binders) (let* ,binders ,@body))) but someone changed it substantially: (defmacro dlet (binders &rest body) "Like `let' but using dynamic scoping." (declare (indent 1) (debug let)) ;; (defvar FOO) only affects the current scope, but in order for ;; this not to affect code after the main `let' we need to create a new scope, ;; which is what the surrounding `let' is for. ;; FIXME: (let () ...) currently doesn't actually create a new scope, ;; which is why we use (let (_) ...). `(let (_) ,@(mapcar (lambda (binder) `(defvar ,(if (consp binder) (car binder) binder))) binders) (let ,binders ,@body))) That small difference was changed, and I was feeling about you: (let* ,binders ,@body) and I complained, because I did not realize how easy it is to make it how I want, so I stole the function and it is done and well! In fact, it is possible to make a package aliasing all cl- functions and it is done. -- Jean Louis