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

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

[elpa] externals/dash fae51b5 147/316: Make -inits not destroy its argum


From: ELPA Syncer
Subject: [elpa] externals/dash fae51b5 147/316: Make -inits not destroy its argument
Date: Mon, 15 Feb 2021 15:57:46 -0500 (EST)

branch: externals/dash
commit fae51b589ba761500bb0e478ddc24589e86ca4cb
Author: Zach Shaftel <zshaftel@gmail.com>
Commit: Zach Shaftel <zshaftel@gmail.com>

    Make -inits not destroy its argument
---
 dash.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dash.el b/dash.el
index f48c517..dbdc733 100644
--- a/dash.el
+++ b/dash.el
@@ -2342,7 +2342,12 @@ or with `-compare-fn' if that's non-nil."
 
 (defun -inits (list)
   "Return all prefixes of LIST."
-  (nreverse (-map 'reverse (-tails (nreverse list)))))
+  (let ((acc nil)
+        (ret (list nil)))
+    (--each list
+      (!cons it acc)
+      (!cons (reverse acc) ret))
+    (nreverse ret)))
 
 (defun -tails (list)
   "Return all suffixes of LIST"



reply via email to

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