;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: sequences
-;; Version: 1.7
+;; Version: 1.8
;; Package: seq
;; Maintainer: emacs-devel@gnu.org
(`list (append seq nil))
(_ (error "Not a sequence type name: %S" type))))
+(defun seq-min (seq)
+ "Return the smallest element of SEQ.
+SEQ must be a sequence of numbers or markers."
+ (apply #'min (seq-into seq 'list)))
+
+(defun seq-max (seq)
+ "Return the largest element of SEQ.
+SEQ must be a sequence of numbers or markers."
+ (apply #'max (seq-into seq 'list)))
+
(defun seq--drop-list (list n)
"Return a list from LIST without its first N elements.
This is an optimization for lists in `seq-drop'."
(should (null b))
(should (null c)))))
+(ert-deftest test-seq-min-max ()
+ (with-test-sequences (seq '(4 5 3 2 0 4))
+ (should (= (seq-min seq) 0))
+ (should (= (seq-max seq) 5))))
+
(provide 'seq-tests)
;;; seq-tests.el ends here