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

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

[elpa] externals/dash f3ae7bb 259/316: Alias -remove-item to remove


From: ELPA Syncer
Subject: [elpa] externals/dash f3ae7bb 259/316: Alias -remove-item to remove
Date: Mon, 15 Feb 2021 15:58:13 -0500 (EST)

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

    Alias -remove-item to remove
    
    * dash.el (-remove-item): Define as an alias of remove for speed.
    * dev/examples.el (-remove-item): Extend tests.
    
    * README.md:
    * dash.texi: Regenerate docs.
---
 README.md       | 15 ++++++++-------
 dash.el         | 10 ++++------
 dash.texi       | 11 ++++++-----
 dev/examples.el |  7 ++++++-
 4 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/README.md b/README.md
index d355116..135bc88 100644
--- a/README.md
+++ b/README.md
@@ -132,7 +132,7 @@ Functions returning a sublist of the original list.
 * [-remove](#-remove-pred-list) `(pred list)`
 * [-remove-first](#-remove-first-pred-list) `(pred list)`
 * [-remove-last](#-remove-last-pred-list) `(pred list)`
-* [-remove-item](#-remove-item-item-list) `(item list)`
+* [-remove-item](#-remove-item-arg1-arg2) `(arg1 arg2)`
 * [-non-nil](#-non-nil-list) `(list)`
 * [-slice](#-slice-list-from-optional-to-step) `(list from &optional to step)`
 * [-take](#-take-n-list) `(n list)`
@@ -548,7 +548,7 @@ original tail.  If no item is removed, then the result is a
 complete copy.
 Alias: `-reject-first`.
 This function's anaphoric counterpart is `--remove-first`.
-See also [`-map-first`](#-map-first-pred-rep-list), 
[`-remove-item`](#-remove-item-item-list), and 
[`-remove-last`](#-remove-last-pred-list).
+See also [`-map-first`](#-map-first-pred-rep-list), 
[`-remove-item`](#-remove-item-arg1-arg2), and 
[`-remove-last`](#-remove-last-pred-list).
 
 ```el
 (-remove-first #'natnump '(-2 -1 0 1 2)) ;; => '(-2 -1 1 2)
@@ -563,7 +563,7 @@ The result is a copy of `list` regardless of whether an 
element is
 removed.
 Alias: `-reject-last`.
 This function's anaphoric counterpart is `--remove-last`.
-See also [`-map-last`](#-map-last-pred-rep-list), 
[`-remove-item`](#-remove-item-item-list), and 
[`-remove-first`](#-remove-first-pred-list).
+See also [`-map-last`](#-map-last-pred-rep-list), 
[`-remove-item`](#-remove-item-arg1-arg2), and 
[`-remove-first`](#-remove-first-pred-list).
 
 ```el
 (-remove-last #'natnump '(1 3 5 4 7 8 10 -11)) ;; => '(1 3 5 4 7 8 -11)
@@ -571,16 +571,17 @@ See also [`-map-last`](#-map-last-pred-rep-list), 
[`-remove-item`](#-remove-item
 (--remove-last (> it 3) '(1 2 3 4 5 6 7 8 9 10)) ;; => '(1 2 3 4 5 6 7 8 9)
 ```
 
-#### -remove-item `(item list)`
+#### -remove-item `(arg1 arg2)`
 
-Remove all occurrences of `item` from `list`.
+Return a copy of `list` with all occurrences of `item` removed.
+The comparison is done with `equal`.
 
-Comparison is done with `equal`.
+(fn `item` `list`)
 
 ```el
 (-remove-item 3 '(1 2 3 2 3 4 5 3)) ;; => '(1 2 2 4 5)
 (-remove-item 'foo '(foo bar baz foo)) ;; => '(bar baz)
-(-remove-item "bob" '("alice" "bob" "eve" "bob" "dave")) ;; => '("alice" "eve" 
"dave")
+(-remove-item "bob" '("alice" "bob" "eve" "bob")) ;; => '("alice" "eve")
 ```
 
 #### -non-nil `(list)`
diff --git a/dash.el b/dash.el
index d499928..449b53a 100644
--- a/dash.el
+++ b/dash.el
@@ -509,12 +509,10 @@ See also `-map-last', `-remove-item', and 
`-remove-first'."
 (defalias '-reject-last '-remove-last)
 (defalias '--reject-last '--remove-last)
 
-(defun -remove-item (item list)
-  "Remove all occurrences of ITEM from LIST.
-
-Comparison is done with `equal'."
-  (declare (pure t) (side-effect-free t))
-  (--remove (equal it item) list))
+(defalias '-remove-item #'remove
+  "Return a copy of LIST with all occurrences of ITEM removed.
+The comparison is done with `equal'.
+\n(fn ITEM LIST)")
 
 (defmacro --keep (form list)
   "Anaphoric form of `-keep'."
diff --git a/dash.texi b/dash.texi
index a37ab85..e55522b 100644
--- a/dash.texi
+++ b/dash.texi
@@ -579,10 +579,11 @@ See also @code{-map-last} (@pxref{-map-last}), 
@code{-remove-item} (@pxref{-remo
 @end defun
 
 @anchor{-remove-item}
-@defun -remove-item (item list)
-Remove all occurrences of @var{item} from @var{list}.
+@defun -remove-item (arg1 arg2)
+Return a copy of @var{list} with all occurrences of @var{item} removed.
+The comparison is done with @code{equal}.
 
-Comparison is done with @code{equal}.
+(fn @var{item} @var{list})
 
 @example
 @group
@@ -594,8 +595,8 @@ Comparison is done with @code{equal}.
     @result{} '(bar baz)
 @end group
 @group
-(-remove-item "bob" '("alice" "bob" "eve" "bob" "dave"))
-    @result{} '("alice" "eve" "dave")
+(-remove-item "bob" '("alice" "bob" "eve" "bob"))
+    @result{} '("alice" "eve")
 @end group
 @end example
 @end defun
diff --git a/dev/examples.el b/dev/examples.el
index 56e95da..ebe616b 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -201,7 +201,12 @@ new list."
   (defexamples -remove-item
     (-remove-item 3 '(1 2 3 2 3 4 5 3)) => '(1 2 2 4 5)
     (-remove-item 'foo '(foo bar baz foo)) => '(bar baz)
-    (-remove-item "bob" '("alice" "bob" "eve" "bob" "dave")) => '("alice" 
"eve" "dave"))
+    (-remove-item "bob" '("alice" "bob" "eve" "bob")) => '("alice" "eve")
+    (-remove-item nil '()) => '()
+    (-remove-item nil '(nil)) => '()
+    (let ((l (list 1 2))) (setcar (-remove-item 0 l) 0) l) => '(1 2)
+    (let ((l (list 1 2))) (setcar (-remove-item 1 l) 0) l) => '(1 2)
+    (let ((l (list 1 2))) (setcar (-remove-item 2 l) 0) l) => '(1 2))
 
   (defexamples -non-nil
     (-non-nil '(1 nil 2 nil nil 3 4 nil 5 nil)) => '(1 2 3 4 5))



reply via email to

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