[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 8248997 234/316: Merge pull request #207 from holo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash 8248997 234/316: Merge pull request #207 from holomorph/iota |
Date: |
Mon, 15 Feb 2021 15:58:07 -0500 (EST) |
branch: externals/dash
commit 82489971fd759cd22b095576ebb4c5ca38cdc17b
Merge: f975634 d308676
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Merge pull request #207 from holomorph/iota
---
dash.el | 17 +++++++++++++++++
dev/examples.el | 5 +++++
2 files changed, 22 insertions(+)
diff --git a/dash.el b/dash.el
index 053eabf..e1c9aca 100644
--- a/dash.el
+++ b/dash.el
@@ -2699,6 +2699,23 @@ The items for the comparator form are exposed as \"it\"
and \"other\"."
(declare (debug (form form)))
`(-min-by (lambda (it other) ,form) ,list))
+(defun -iota (count &optional start step)
+ "Return a list containing COUNT numbers.
+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."
+ (when (not (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))))
+
(defun -fix (fn list)
"Compute the (least) fixpoint of FN with initial input LIST.
diff --git a/dev/examples.el b/dev/examples.el
index d83d282..a0f1975 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -879,6 +879,11 @@ value rather than consuming a list to produce a single
value."
(-interleave '(1 2 3) '("a" "b" "c" "d")) => '(1 "a" 2 "b" 3 "c")
(-interleave) => nil)
+ (defexamples -iota
+ (-iota 6) => '(0 1 2 3 4 5)
+ (-iota 4 2.5 -2) => '(2.5 0.5 -1.5 -3.5)
+ (-iota -1) !!> wrong-type-argument)
+
(defexamples -zip-with
(-zip-with '+ '(1 2 3) '(4 5 6)) => '(5 7 9)
(-zip-with 'cons '(1 2 3) '(4 5 6)) => '((1 . 4) (2 . 5) (3 . 6))
- [elpa] externals/dash 2a94ea5 209/316: Remove unnecessary helper function, (continued)
- [elpa] externals/dash 2a94ea5 209/316: Remove unnecessary helper function, ELPA Syncer, 2021/02/15
- [elpa] externals/dash adf3a0d 208/316: Merge pull request #359 from blc/make, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1d58249 212/316: Write -iterate in terms of --iterate, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 47f8b2b 214/316: Clean up -doto, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 794bf8c 219/316: ; Fix omission in last change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f9d67ae 223/316: Merge pull request #314 from blc/reductions, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 31a655b 224/316: Fix -cons* with no arguments, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 3423be4 227/316: Merge pull request #364 from blc/info-look, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 558cd95 230/316: Fix take/drop splits (again), ELPA Syncer, 2021/02/15
- [elpa] externals/dash f975634 233/316: Merge pull request #235, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 8248997 234/316: Merge pull request #207 from holomorph/iota,
ELPA Syncer <=
- [elpa] externals/dash 3694ae9 236/316: * dash.el (-iota): Simplify and purify., ELPA Syncer, 2021/02/15
- [elpa] externals/dash ca36c57 239/316: Allow -lambda with no arguments, ELPA Syncer, 2021/02/15
- [elpa] externals/dash bf8a462 243/316: Partially revert last change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash d7d0acb 242/316: Don't call eval, ELPA Syncer, 2021/02/15
- [elpa] externals/dash bf8d876 238/316: Merge pull request #363 from blc/list, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 76ace7f 240/316: Fix error signaling, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1ccf08d 244/316: ; Fix last change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 2625bc5 247/316: Don't use insert-file-contents-literally, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 7583e65 248/316: Revert --map to using mapcar, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 6f5888c 251/316: Extend --filter and --remove docs and tests, ELPA Syncer, 2021/02/15