branch: externals/dash
commit c788474b4cf9fb3a85a8b1c4627e6e2f73a5b53c
Author: Matus Goljer <[email protected]>
Commit: Matus Goljer <[email protected]>
Fix bug with nested lists in `-remove-at-indices`
---
dash.el | 2 +-
dev/examples.el | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dash.el b/dash.el
index bab597a..1eab3eb 100644
--- a/dash.el
+++ b/dash.el
@@ -524,7 +524,7 @@ from INDICES."
(!cons (car split) r)
(setq list (cdr (cadr split)))))
(!cons list r)
- (-flatten (nreverse r))))
+ (apply '-concat (nreverse r))))
(defmacro --split-with (pred list)
"Anaphoric form of `-split-with'."
diff --git a/dev/examples.el b/dev/examples.el
index a222b23..db71ca9 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -108,7 +108,9 @@
(-remove-at 2 '("0" "1" "2" "3" "4" "5")) => '("0" "1" "3" "4" "5")
(-remove-at 3 '("0" "1" "2" "3" "4" "5")) => '("0" "1" "2" "4" "5")
(-remove-at 4 '("0" "1" "2" "3" "4" "5")) => '("0" "1" "2" "3" "5")
- (-remove-at 5 '("0" "1" "2" "3" "4" "5")) => '("0" "1" "2" "3" "4"))
+ (-remove-at 5 '("0" "1" "2" "3" "4" "5")) => '("0" "1" "2" "3" "4")
+ (-remove-at 5 '((a b) (c d) (e f g) h i ((j) k) l (m))) => '((a b) (c d) (e
f g) h i l (m))
+ (-remove-at 0 '(((a b) (c d) (e f g) h i ((j) k) l (m)))) => nil)
(defexamples -remove-at-indices
(-remove-at-indices '(0) '("0" "1" "2" "3" "4" "5")) => '("1" "2" "3" "4"
"5")
@@ -124,7 +126,11 @@
(-remove-at-indices '(2) '("0" "1" "2" "3" "4" "5")) => '("0" "1" "3" "4"
"5")
(-remove-at-indices '(3) '("0" "1" "2" "3" "4" "5")) => '("0" "1" "2" "4"
"5")
(-remove-at-indices '(4) '("0" "1" "2" "3" "4" "5")) => '("0" "1" "2" "3"
"5")
- (-remove-at-indices '(5) '("0" "1" "2" "3" "4" "5")) => '("0" "1" "2" "3"
"4"))
+ (-remove-at-indices '(5) '("0" "1" "2" "3" "4" "5")) => '("0" "1" "2" "3"
"4")
+ (-remove-at-indices '(1 2 4) '((a b) (c d) (e f g) h i ((j) k) l (m))) =>
'((a b) h ((j) k) l (m))
+ (-remove-at-indices '(5) '((a b) (c d) (e f g) h i ((j) k) l (m))) => '((a
b) (c d) (e f g) h i l (m))
+ (-remove-at-indices '(0) '(((a b) (c d) (e f g) h i ((j) k) l (m)))) => nil
+ (-remove-at-indices '(2 3) '((0) (1) (2) (3) (4) (5) (6))) => '((0) (1) (4)
(5) (6)))
(def-example-group "Reductions" nil
(defexamples -reduce-from