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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dash b3c58ff 221/316: Fix docstring of -list


From: ELPA Syncer
Subject: [elpa] externals/dash b3c58ff 221/316: Fix docstring of -list
Date: Mon, 15 Feb 2021 15:58:04 -0500 (EST)

branch: externals/dash
commit b3c58ffdb1739d601bc388cc7c7a9e7bd8e753f5
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Fix docstring of -list
    
    * dash.el (-list): Fix doc in the case that the first argument is
    already a list.
    * dev/examples.el (-list): Expand tests.
    
    * README.md:
    * dash.texi: Regenerate docs.
    
    Fixes #225.
---
 README.md       |  7 +++----
 dash.el         | 10 ++++------
 dash.texi       |  7 +++----
 dev/examples.el |  7 ++++++-
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md
index ec1b8a7..780f941 100644
--- a/README.md
+++ b/README.md
@@ -2034,10 +2034,9 @@ if the first element should sort before the second.
 
 #### -list `(&rest args)`
 
-Return a list with `args`.
-
-If first item of `args` is already a list, simply return `args`.  If
-not, return a list with `args` as elements.
+Return a list based on `args`.
+If the first item of `args` is already a list, simply return it.
+Otherwise, return a list with `args` as elements.
 
 ```el
 (-list 1) ;; => '(1)
diff --git a/dash.el b/dash.el
index e65a8d0..2303681 100644
--- a/dash.el
+++ b/dash.el
@@ -2515,13 +2515,11 @@ if the first element should sort before the second."
   `(-sort (lambda (it other) ,form) ,list))
 
 (defun -list (&rest args)
-  "Return a list with ARGS.
-
-If first item of ARGS is already a list, simply return ARGS.  If
-not, return a list with ARGS as elements."
+  "Return a list based on ARGS.
+If the first item of ARGS is already a list, simply return it.
+Otherwise, return a list with ARGS as elements."
   (declare (pure t) (side-effect-free t))
-  (let ((arg (car args)))
-    (if (listp arg) arg args)))
+  (if (listp (car args)) (car args) args))
 
 (defun -repeat (n x)
   "Return a new list of length N with each element being X.
diff --git a/dash.texi b/dash.texi
index 3aea063..bf1bd7b 100644
--- a/dash.texi
+++ b/dash.texi
@@ -3116,10 +3116,9 @@ if the first element should sort before the second.
 
 @anchor{-list}
 @defun -list (&rest args)
-Return a list with @var{args}.
-
-If first item of @var{args} is already a list, simply return @var{args}.  If
-not, return a list with @var{args} as elements.
+Return a list based on @var{args}.
+If the first item of @var{args} is already a list, simply return it.
+Otherwise, return a list with @var{args} as elements.
 
 @example
 @group
diff --git a/dev/examples.el b/dev/examples.el
index a7a95ed..0715e20 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -926,7 +926,12 @@ value rather than consuming a list to produce a single 
value."
     (-list 1) => '(1)
     (-list 1 2 3) => '(1 2 3)
     (-list '(1 2 3)) => '(1 2 3)
-    (-list '((1) (2))) => '((1) (2)))
+    (-list '((1) (2))) => '((1) (2))
+    (-list) => ()
+    (-list ()) => ()
+    (-list () 1) => ()
+    (-list '(())) => '(())
+    (-list '(() 1)) => '(() 1))
 
   (defexamples -fix
     (-fix (lambda (l) (-non-nil (--mapcat (-split-at (/ (length it) 2) it) 
l))) '((1 2 3 4 5 6))) => '((1) (2) (3) (4) (5) (6))



reply via email to

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