[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash f975634 233/316: Merge pull request #235
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash f975634 233/316: Merge pull request #235 |
Date: |
Mon, 15 Feb 2021 15:58:07 -0500 (EST) |
branch: externals/dash
commit f97563436da02552b828faf063cd0a78db3d7d41
Merge: 558cd95 3034638
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Merge pull request #235
---
README.md | 20 ++++++++++----------
dash.el | 28 ++++++++++++----------------
dash.texi | 20 ++++++++++----------
dev/examples.el | 8 ++++----
4 files changed, 36 insertions(+), 40 deletions(-)
diff --git a/README.md b/README.md
index 669c241..778fa2c 100644
--- a/README.md
+++ b/README.md
@@ -1624,24 +1624,24 @@ predicate `pred`, in ascending order.
#### -grade-up `(comparator list)`
-Grade elements of `list` using `comparator` relation, yielding a
-permutation vector such that applying this permutation to `list`
-sorts it in ascending order.
+Grade elements of `list` using `comparator` relation.
+This yields a permutation vector such that applying this
+permutation to `list` sorts it in ascending order.
```el
-(-grade-up '< '(3 1 4 2 1 3 3)) ;; => '(1 4 3 0 5 6 2)
-(let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-up '< l) l)) ;; => '(1
1 2 3 3 3 4)
+(-grade-up #'< '(3 1 4 2 1 3 3)) ;; => '(1 4 3 0 5 6 2)
+(let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-up #'< l) l)) ;; =>
'(1 1 2 3 3 3 4)
```
#### -grade-down `(comparator list)`
-Grade elements of `list` using `comparator` relation, yielding a
-permutation vector such that applying this permutation to `list`
-sorts it in descending order.
+Grade elements of `list` using `comparator` relation.
+This yields a permutation vector such that applying this
+permutation to `list` sorts it in descending order.
```el
-(-grade-down '< '(3 1 4 2 1 3 3)) ;; => '(2 0 5 6 3 1 4)
-(let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-down '< l) l)) ;; =>
'(4 3 3 3 2 1 1)
+(-grade-down #'< '(3 1 4 2 1 3 3)) ;; => '(2 0 5 6 3 1 4)
+(let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-down #'< l) l)) ;; =>
'(4 3 3 3 2 1 1)
```
diff --git a/dash.el b/dash.el
index 5f6b8e5..053eabf 100644
--- a/dash.el
+++ b/dash.el
@@ -1755,24 +1755,20 @@ Note: `it' need not be used in each form."
it))
(defun -grade-up (comparator list)
- "Grade elements of LIST using COMPARATOR relation, yielding a
-permutation vector such that applying this permutation to LIST
-sorts it in ascending order."
- ;; ugly hack to "fix" lack of lexical scope
- (let ((comp `(lambda (it other) (funcall ',comparator (car it) (car
other)))))
- (->> (--map-indexed (cons it it-index) list)
- (-sort comp)
- (-map 'cdr))))
+ "Grade elements of LIST using COMPARATOR relation.
+This yields a permutation vector such that applying this
+permutation to LIST sorts it in ascending order."
+ (->> (--map-indexed (cons it it-index) list)
+ (-sort (lambda (it other) (funcall comparator (car it) (car other))))
+ (mapcar #'cdr)))
(defun -grade-down (comparator list)
- "Grade elements of LIST using COMPARATOR relation, yielding a
-permutation vector such that applying this permutation to LIST
-sorts it in descending order."
- ;; ugly hack to "fix" lack of lexical scope
- (let ((comp `(lambda (it other) (funcall ',comparator (car other) (car
it)))))
- (->> (--map-indexed (cons it it-index) list)
- (-sort comp)
- (-map 'cdr))))
+ "Grade elements of LIST using COMPARATOR relation.
+This yields a permutation vector such that applying this
+permutation to LIST sorts it in descending order."
+ (->> (--map-indexed (cons it it-index) list)
+ (-sort (lambda (it other) (funcall comparator (car other) (car it))))
+ (mapcar #'cdr)))
(defvar dash--source-counter 0
"Monotonic counter for generated symbols.")
diff --git a/dash.texi b/dash.texi
index a52633a..352e790 100644
--- a/dash.texi
+++ b/dash.texi
@@ -2405,17 +2405,17 @@ predicate @var{pred}, in ascending order.
@anchor{-grade-up}
@defun -grade-up (comparator list)
-Grade elements of @var{list} using @var{comparator} relation, yielding a
-permutation vector such that applying this permutation to @var{list}
-sorts it in ascending order.
+Grade elements of @var{list} using @var{comparator} relation.
+This yields a permutation vector such that applying this
+permutation to @var{list} sorts it in ascending order.
@example
@group
-(-grade-up '< '(3 1 4 2 1 3 3))
+(-grade-up #'< '(3 1 4 2 1 3 3))
@result{} '(1 4 3 0 5 6 2)
@end group
@group
-(let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-up '< l) l))
+(let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-up #'< l) l))
@result{} '(1 1 2 3 3 3 4)
@end group
@end example
@@ -2423,17 +2423,17 @@ sorts it in ascending order.
@anchor{-grade-down}
@defun -grade-down (comparator list)
-Grade elements of @var{list} using @var{comparator} relation, yielding a
-permutation vector such that applying this permutation to @var{list}
-sorts it in descending order.
+Grade elements of @var{list} using @var{comparator} relation.
+This yields a permutation vector such that applying this
+permutation to @var{list} sorts it in descending order.
@example
@group
-(-grade-down '< '(3 1 4 2 1 3 3))
+(-grade-down #'< '(3 1 4 2 1 3 3))
@result{} '(2 0 5 6 3 1 4)
@end group
@group
-(let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-down '< l) l))
+(let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-down #'< l) l))
@result{} '(4 3 3 3 2 1 1)
@end group
@end example
diff --git a/dev/examples.el b/dev/examples.el
index 564d3ef..d83d282 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -776,12 +776,12 @@ value rather than consuming a list to produce a single
value."
(-find-indices (-partial 'string-lessp "baz") '("bar" "foo" "baz")) =>
'(1))
(defexamples -grade-up
- (-grade-up '< '(3 1 4 2 1 3 3)) => '(1 4 3 0 5 6 2)
- (let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-up '< l) l)) =>
'(1 1 2 3 3 3 4))
+ (-grade-up #'< '(3 1 4 2 1 3 3)) => '(1 4 3 0 5 6 2)
+ (let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-up #'< l) l)) =>
'(1 1 2 3 3 3 4))
(defexamples -grade-down
- (-grade-down '< '(3 1 4 2 1 3 3)) => '(2 0 5 6 3 1 4)
- (let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-down '< l) l)) =>
'(4 3 3 3 2 1 1)))
+ (-grade-down #'< '(3 1 4 2 1 3 3)) => '(2 0 5 6 3 1 4)
+ (let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-down #'< l) l)) =>
'(4 3 3 3 2 1 1)))
(def-example-group "Set operations"
"Operations pretending lists are sets."
- [elpa] externals/dash e8cc2ec 205/316: Merge pull request #358 from blc/texi, (continued)
- [elpa] externals/dash e8cc2ec 205/316: Merge pull request #358 from blc/texi, ELPA Syncer, 2021/02/15
- [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 <=
- [elpa] externals/dash 8248997 234/316: Merge pull request #207 from holomorph/iota, ELPA Syncer, 2021/02/15
- [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