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

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

[elpa] externals/dash 7583e65 248/316: Revert --map to using mapcar


From: ELPA Syncer
Subject: [elpa] externals/dash 7583e65 248/316: Revert --map to using mapcar
Date: Mon, 15 Feb 2021 15:58:10 -0500 (EST)

branch: externals/dash
commit 7583e6511bd2d34c6ce872450ec39732968c9db4
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Revert --map to using mapcar
    
    Code in the wild relies on mapcar for working with non-list
    sequences, and mapcar can still be faster in some degenerate cases.
    
    * dash.el (--map): Use mapcar again.
    
    Fixes #365.
---
 dash.el | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/dash.el b/dash.el
index a60b107..2909e07 100644
--- a/dash.el
+++ b/dash.el
@@ -207,14 +207,7 @@ Each element of LIST in turn is bound to `it' before 
evaluating
 BODY.
 This is the anaphoric counterpart to `-map'."
   (declare (debug (form form)))
-  (let ((l (make-symbol "list"))
-        (r (make-symbol "res")))
-    `(let ((,l ,list) ,r it)
-       (ignore it)
-       (while ,l
-         (setq it (pop ,l))
-         (push ,form ,r))
-       (nreverse ,r))))
+  `(mapcar (lambda (it) (ignore it) ,form) ,list))
 
 (defmacro --reduce-from (form init list)
   "Accumulate a value by evaluating FORM across LIST.



reply via email to

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