[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash a6e1436 124/316: Add -common-suffix
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash a6e1436 124/316: Add -common-suffix |
Date: |
Mon, 15 Feb 2021 15:57:40 -0500 (EST) |
branch: externals/dash
commit a6e143682f7f75896b7383b408f492c9a7726df4
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Add -common-suffix
Update -common-prefix tests along with those of -common-suffix.
---
dash.el | 5 +++++
dev/examples.el | 17 ++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dash.el b/dash.el
index 8d1d9a6..08924e2 100644
--- a/dash.el
+++ b/dash.el
@@ -2310,6 +2310,10 @@ or with `-compare-fn' if that's non-nil."
(--reduce (--take-while (and acc (equal (pop acc) it)) it)
lists))
+(defun -common-suffix (&rest lists)
+ "Return the longest common suffix of LISTS."
+ (nreverse (apply #'-common-prefix (mapcar #'reverse lists))))
+
(defun -contains? (list element)
"Return non-nil if LIST contains ELEMENT.
@@ -2904,6 +2908,7 @@ structure such as plist or alist."
"-inits"
"-tails"
"-common-prefix"
+ "-common-suffix"
"-contains?"
"-contains-p"
"-same-items?"
diff --git a/dev/examples.el b/dev/examples.el
index 05669e9..43c0ace 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -389,13 +389,28 @@ new list."
(defexamples -common-prefix
(-common-prefix '(1)) => '(1)
- (-common-prefix '(1 2) () '(1 2)) => ()
+ (-common-prefix '(1 2) '(3 4) '(1 2)) => ()
(-common-prefix '(1 2) '(1 2 3) '(1 2 3 4)) => '(1 2)
+ (-common-prefix () '(1 2) '(1 2)) => ()
+ (-common-prefix '(1 2) '(1 2) ()) => ()
+ (-common-prefix '(1) '(1)) => '(1)
(-common-prefix '(())) => '(())
(-common-prefix () ()) => ()
(-common-prefix ()) => ()
(-common-prefix) => ())
+ (defexamples -common-suffix
+ (-common-suffix '(1)) => '(1)
+ (-common-suffix '(1 2) '(3 4) '(1 2)) => ()
+ (-common-suffix '(1 2 3 4) '(2 3 4) '(3 4)) => '(3 4)
+ (-common-suffix () '(1 2) '(1 2)) => ()
+ (-common-suffix '(1 2) '(1 2) ()) => ()
+ (-common-suffix '(1) '(1)) => '(1)
+ (-common-suffix '(())) => '(())
+ (-common-suffix () ()) => ()
+ (-common-suffix ()) => ()
+ (-common-suffix) => ())
+
(defexamples -min
(-min '(0)) => 0
(-min '(3 2 1)) => 1
- [elpa] externals/dash 1b9061c 090/316: Update docs, (continued)
- [elpa] externals/dash 1b9061c 090/316: Update docs, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 528e5a5 095/316: Merge pull request #258 from Wilfred/quotes-in-docs, ELPA Syncer, 2021/02/15
- [elpa] externals/dash c77644b 092/316: Regenerate docs, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 27c2fe8 100/316: Add missing keywords, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 83190a2 106/316: Emacs 26.1 was released and pretest does no longer exist, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0505f5d 109/316: Merge pull request #271 from magnars/feature/-setq, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 148404c 114/316: [Fix #256] Allow `-let` bindings with no explicit value, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f1ffdf7 131/316: Merge pull request #288 from cireu/master, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 6d2decb 122/316: Prefer number-to-string over int-to-string, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 3f7bc26 132/316: Provided option to extend destructoring, ELPA Syncer, 2021/02/15
- [elpa] externals/dash a6e1436 124/316: Add -common-suffix,
ELPA Syncer <=
- [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