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

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

[elpa] externals/dash 3694ae9 236/316: * dash.el (-iota): Simplify and p


From: ELPA Syncer
Subject: [elpa] externals/dash 3694ae9 236/316: * dash.el (-iota): Simplify and purify.
Date: Mon, 15 Feb 2021 15:58:08 -0500 (EST)

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

    * dash.el (-iota): Simplify and purify.
    
    Re: #215.
---
 dash.el | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/dash.el b/dash.el
index 68d2749..b12588c 100644
--- a/dash.el
+++ b/dash.el
@@ -2705,16 +2705,14 @@ Starts from START and adds STEP each time.  The default 
START is
 zero, the default STEP is 1.
 This function takes its name from the corresponding primitive in
 the APL language."
+  (declare (pure t) (side-effect-free t))
   (unless (natnump count)
     (signal 'wrong-type-argument (list #'natnump count)))
   (or start (setq start 0))
   (or step (setq step 1))
-  (if (zerop step) (make-list count start)
-    (let (result)
-      (while (<= 0 (setq count (1- count)))
-        (push start result)
-        (setq start (+ start step)))
-      (nreverse result))))
+  (if (zerop step)
+      (make-list count start)
+    (--iterate (+ it step) start count)))
 
 (defun -fix (fn list)
   "Compute the (least) fixpoint of FN with initial input LIST.



reply via email to

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