all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] * lisp/emacs-lisp/seq.el (seq-drop): Use nthcdr for lists.
@ 2016-06-12  0:29 Mark Oteiza
  2016-06-12 10:42 ` Nicolas Petton
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Oteiza @ 2016-06-12  0:29 UTC (permalink / raw)
  To: emacs-devel; +Cc: Nicolas Petton

---
 lisp/emacs-lisp/seq.el | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 8362dda..2bb1381 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -449,10 +449,7 @@ seq--elt-safe
 
 (cl-defmethod seq-drop ((list list) n)
   "Optimized implementation of `seq-drop' for lists."
-  (while (and list (> n 0))
-    (setq list (cdr list)
-          n (1- n)))
-  list)
+  (nthcdr n list))
 
 (cl-defmethod seq-take ((list list) n)
   "Optimized implementation of `seq-take' for lists."
-- 
2.8.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] * lisp/emacs-lisp/seq.el (seq-drop): Use nthcdr for lists.
  2016-06-12  0:29 [PATCH] * lisp/emacs-lisp/seq.el (seq-drop): Use nthcdr for lists Mark Oteiza
@ 2016-06-12 10:42 ` Nicolas Petton
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Petton @ 2016-06-12 10:42 UTC (permalink / raw)
  To: Mark Oteiza, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

Mark Oteiza <mvoteiza@udel.edu> writes:

Hi Mark,


>  (cl-defmethod seq-drop ((list list) n)
>    "Optimized implementation of `seq-drop' for lists."
> -  (while (and list (> n 0))
> -    (setq list (cdr list)
> -          n (1- n)))
> -  list)
> +  (nthcdr n list))

Thanks, I applied the patch in both Emacs and ELPA.

Cheers,
Nico

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-12 10:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-12  0:29 [PATCH] * lisp/emacs-lisp/seq.el (seq-drop): Use nthcdr for lists Mark Oteiza
2016-06-12 10:42 ` Nicolas Petton

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.