emacs-elpa-diffs
[Top][All Lists]
Advanced

[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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]