[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 09a66ce: Fix circular list handling in seq-mapn
From: |
Nicolas Petton |
Subject: |
[Emacs-diffs] master 09a66ce: Fix circular list handling in seq-mapn |
Date: |
Thu, 15 Dec 2016 09:26:15 +0000 (UTC) |
branch: master
commit 09a66ceb5e906e704be58d5f40c45096307f0b9e
Author: Nicolas Petton <address@hidden>
Commit: Nicolas Petton <address@hidden>
Fix circular list handling in seq-mapn
* lisp/emacs-lisp/seq.el (seq-mapn): Do not copy list arguments.
* test/lisp/emacs-lisp/seq-tests.el (test-seq-mapn-circular-lists):
Add a regression test.
---
lisp/emacs-lisp/seq.el | 5 ++++-
test/lisp/emacs-lisp/seq-tests.el | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 5ddc5a5..9890e60 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -178,7 +178,10 @@ Return a list of the results.
\(fn FUNCTION SEQUENCES...)"
(let ((result nil)
- (sequences (seq-map (lambda (s) (seq-into s 'list))
+ (sequences (seq-map (lambda (s)
+ (if (listp s)
+ s
+ (seq-into s 'list)))
(cons sequence sequences))))
(while (not (memq nil sequences))
(push (apply function (seq-map #'car sequences)) result)
diff --git a/test/lisp/emacs-lisp/seq-tests.el
b/test/lisp/emacs-lisp/seq-tests.el
index 2e533ac..fc65c98 100644
--- a/test/lisp/emacs-lisp/seq-tests.el
+++ b/test/lisp/emacs-lisp/seq-tests.el
@@ -386,5 +386,10 @@ Evaluate BODY for each created sequence.
(should-error (seq-random-elt []))
(should-error (seq-random-elt "")))
+(ert-deftest test-seq-mapn-circular-lists ()
+ (let ((l1 '#1=(1 . #1#)))
+ (should (equal (seq-mapn #'+ '(3 4 5 7) l1)
+ '(4 5 6 8)))))
+
(provide 'seq-tests)
;;; seq-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 09a66ce: Fix circular list handling in seq-mapn,
Nicolas Petton <=