[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 3034638 232/316: Tidy up -grade-up and -grade-down
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash 3034638 232/316: Tidy up -grade-up and -grade-down a bit |
Date: |
Mon, 15 Feb 2021 15:58:07 -0500 (EST) |
branch: externals/dash
commit 3034638ec13bb6087542ea11c6a5a195e7a0d39b
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Tidy up -grade-up and -grade-down a bit
* dash.el (-grade-up, -grade-down): Fix docstring. Simplify.
* dev/examples.el (-grade-up, -grade-down): Quote function symbols
as such.
* README.md:
* dash.texi: Regenerate docs.
Re: #235.
---
README.md | 20 ++++++++++----------
dash.el | 16 ++++++++--------
dash.texi | 20 ++++++++++----------
dev/examples.el | 8 ++++----
4 files changed, 32 insertions(+), 32 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 c7759a1..053eabf 100644
--- a/dash.el
+++ b/dash.el
@@ -1755,20 +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."
+ "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))))
- (-map 'cdr)))
+ (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."
+ "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))))
- (-map 'cdr)))
+ (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 a87df31 111/316: Merge pull request #269 from magnars/feature/smart-kv-destructuring, (continued)
- [elpa] externals/dash a87df31 111/316: Merge pull request #269 from magnars/feature/smart-kv-destructuring, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 406f6f3 112/316: Fix whitespace, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 8f90dd7 121/316: Handle empty list in -reductions[-r], ELPA Syncer, 2021/02/15
- [elpa] externals/dash 453c775 115/316: Fix -setq docstring fn reference, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 85e8f62 119/316: Merge pull request #274 from magnars/doublep-each-r, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1e22ef6 125/316: Merge pull request #263 from basil-conto/blc/common-suffix, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 78fee36 190/316: * .dir-locals.el (sh-mode): Enforce indentation., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1d897cc 199/316: Simplify examples-to-docs a bit, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 3d38fa2 213/316: Use actual dash-functional.el version in manual, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 92393c7 220/316: Clean up core definitions, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 3034638 232/316: Tidy up -grade-up and -grade-down a bit,
ELPA Syncer <=
- [elpa] externals/dash 9256290 241/316: * dash.el (-->): Indent with 1 distinguished arg., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 7a9c937 250/316: Translate non-printable chars in docs, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 5d7077a 070/316: Set text-quoting-style, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 322373a 141/316: Remove mention of Marmalade, ELPA Syncer, 2021/02/15
- [elpa] externals/dash a5706bb 144/316: More test to cover cases on different `-compare-fn`, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 25030c9 150/316: Fix test harness in Emacs 27, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 68bd347 160/316: Fix typos, ELPA Syncer, 2021/02/15
- [elpa] externals/dash e85ed7a 163/316: Merge pull request #324 from wbolster/use-bash-for-pre-commit-script, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1db0854 176/316: Add badges to README., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0517ab1 185/316: Optimize -cycle a bit, ELPA Syncer, 2021/02/15