emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat f8f6803 1/2: Follow cl--self-tco's handling of c


From: ELPA Syncer
Subject: [elpa] externals/compat f8f6803 1/2: Follow cl--self-tco's handling of cond more closely
Date: Fri, 29 Oct 2021 18:57:14 -0400 (EDT)

branch: externals/compat
commit f8f68031955f0fc88cddf09b26ae6139b74b6357
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Follow cl--self-tco's handling of cond more closely
---
 compat-28.1.el | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/compat-28.1.el b/compat-28.1.el
index e6cdbf6..f251127 100644
--- a/compat-28.1.el
+++ b/compat-28.1.el
@@ -427,16 +427,18 @@ as the new values of the bound variables in the recursive 
invocation."
                                 (funcall tco (caddr expr)))
                           (funcall tco-progn (cdddr expr))))
                  ((eq (car-safe expr) 'cond)
-                  (cons 'cond
-                        (mapcar
-                         (lambda (branch)
-                           (if (cdr branch)
-                               (cons (car branch)
-                                     (funcall tco-progn (cdr branch)))
-                             (let ((var (make-symbol "head")))
-                               `((let ((,var ,(car branch)))
-                                   (and ,var ,(funcall tco var)))))))
-                         (cdr expr))))
+                  (let ((last-branch (car (last expr))))
+                    (cons 'cond
+                          (mapcar
+                           (lambda (branch)
+                             (cond
+                              ((cdr branch)
+                               (funcall tco-progn branch))
+                              ((and (eq (car-safe (car branch)) name)
+                                    (eq last-branch branch))
+                               (list t (funcall tco (car branch))))
+                              (branch)))
+                           (cdr expr)))))
                  ((eq (car-safe expr) 'or)
                   (if (cddr expr)
                       (let ((var (make-symbol "var")))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]