Add seq-min and seq-max
Bump version number. * lisp/emacs-lisp/seq.el (seq-min, seq-max): New functions. * test/automated/seq-tests.el: Add tests for seq-min and seq-max.
This commit is contained in:
parent
3bea77f655
commit
b1047c3b42
2 changed files with 16 additions and 1 deletions
lisp/emacs-lisp
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Nicolas Petton <nicolas@petton.fr>
|
||||
;; Keywords: sequences
|
||||
;; Version: 1.7
|
||||
;; Version: 1.8
|
||||
;; Package: seq
|
||||
|
||||
;; Maintainer: emacs-devel@gnu.org
|
||||
|
@ -325,6 +325,16 @@ TYPE can be one of the following symbols: vector, string or list."
|
|||
(`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'."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue