[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 84721fc 206/316: Optimize -repeat a bit
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash 84721fc 206/316: Optimize -repeat a bit |
Date: |
Mon, 15 Feb 2021 15:58:01 -0500 (EST) |
branch: externals/dash
commit 84721fc466d7546556e1978a308d27ca99cad36c
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Optimize -repeat a bit
* dash.el (-repeat): Use make-list.
* README.md (Other list operations):
* dash.texi (Other list operations): Regenerate docs.
---
README.md | 2 +-
dash.el | 6 ++----
dash.texi | 2 +-
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 10508fa..5b3ee0e 100644
--- a/README.md
+++ b/README.md
@@ -1688,7 +1688,7 @@ The time complexity is `o`(n).
#### -repeat `(n x)`
-Return a list with `x` repeated `n` times.
+Return a new list of length `n` with each element being `x`.
Return nil if `n` is less than 1.
```el
diff --git a/dash.el b/dash.el
index 08a5cf9..840e704 100644
--- a/dash.el
+++ b/dash.el
@@ -2473,12 +2473,10 @@ not, return a list with ARGS as elements."
(if (listp arg) arg args)))
(defun -repeat (n x)
- "Return a list with X repeated N times.
+ "Return a new list of length N with each element being X.
Return nil if N is less than 1."
(declare (pure t) (side-effect-free t))
- (let (ret)
- (--dotimes n (!cons x ret))
- ret))
+ (and (natnump n) (make-list n x)))
(defun -sum (list)
"Return the sum of LIST."
diff --git a/dash.texi b/dash.texi
index b8274d1..65e8061 100644
--- a/dash.texi
+++ b/dash.texi
@@ -2537,7 +2537,7 @@ The time complexity is @var{o}(n).
@anchor{-repeat}
@defun -repeat (n x)
-Return a list with @var{x} repeated @var{n} times.
+Return a new list of length @var{n} with each element being @var{x}.
Return nil if @var{n} is less than 1.
@example
- [elpa] externals/dash 016e0de 133/316: Generalize `-rotate` for `|n|` greater than `(length list)`., (continued)
- [elpa] externals/dash 016e0de 133/316: Generalize `-rotate` for `|n|` greater than `(length list)`., ELPA Syncer, 2021/02/15
- [elpa] externals/dash bbf8016 138/316: Remove dependecy `cl-lib` in tests., ELPA Syncer, 2021/02/15
- [elpa] externals/dash f3e9cd2 151/316: Fix doc and test harnesses (#309), ELPA Syncer, 2021/02/15
- [elpa] externals/dash 070b569 156/316: Add missing indent declaration for ‘-some->’ and siblings, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 800c25d 166/316: feat(docs): simplify (function x) to #'x, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 53323ec 169/316: Fix typo and its copies, ELPA Syncer, 2021/02/15
- [elpa] externals/dash fe9bbc2 170/316: Merge pull request #334 from tarsiiformes/typo, ELPA Syncer, 2021/02/15
- [elpa] externals/dash e4e5269 180/316: Finish last change to package keywords, ELPA Syncer, 2021/02/15
- [elpa] externals/dash b329938 182/316: Update CI configuration, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 7629dae 183/316: Add dir-locals-file with useful settings, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 84721fc 206/316: Optimize -repeat a bit,
ELPA Syncer <=
- [elpa] externals/dash d983d4f 217/316: Fix -doto, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 66e3e94 079/316: Define -second-item through to -fifth-item, ELPA Syncer, 2021/02/15
- [elpa] externals/dash dd30a1f 047/316: [Feature #196] Add -powerset and -permutations (#203), ELPA Syncer, 2021/02/15
- [elpa] externals/dash 5f7f2d6 056/316: Add example for an iota error condition, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 524e6fe 057/316: Fix -map-last docs (#220), ELPA Syncer, 2021/02/15
- [elpa] externals/dash a3b40f8 058/316: Make --> bind IT for use anywhere in FORMS, and add -as->., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 13f9ece 060/316: add tests for nesting anaphoric macros., ELPA Syncer, 2021/02/15
- [elpa] externals/dash d7b769b 065/316: Use standard Emacs quoting for bound symbols, ELPA Syncer, 2021/02/15
- [elpa] externals/dash b4faa93 066/316: Merge pull request #224 from Wilfred/when-let-docstring, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0df0ff1 067/316: Merge pull request #222 from zck/partition-before-after, ELPA Syncer, 2021/02/15