1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

New convenience functions in seq.el

Functions to access the first or all but the first elements of
sequences have been repeatedly asked for (the last occurrence being
https://github.com/NicolasPetton/seq.el/issues/9).

* lisp/emacs-lisp/seq.el (seq-first, seq-rest): New functions.
* test/lisp/emacs-lisp/seq-tests.el (test-seq-first, test-seq-rest):
New tests for seq-first and seq-rest.
This commit is contained in:
Nicolas Petton 2018-12-18 09:42:50 +01:00
parent 73b2f7ac69
commit 5a9eba603d
No known key found for this signature in database
GPG key ID: E8BCD7866AFCF978
2 changed files with 21 additions and 1 deletions

View file

@ -424,5 +424,17 @@ Evaluate BODY for each created sequence.
(should (eq (seq-into vec 'vector) vec))
(should (eq (seq-into str 'string) str))))
(ert-deftest test-seq-first ()
(let ((lst '(1 2 3))
(vec [1 2 3]))
(should (eq (seq-first lst) 1))
(should (eq (seq-first vec) 1))))
(ert-deftest test-seq-rest ()
(let ((lst '(1 2 3))
(vec [1 2 3]))
(should (equal (seq-rest lst) '(2 3)))
(should (equal (seq-rest vec) [2 3]))))
(provide 'seq-tests)
;;; seq-tests.el ends here