diff options
author | Nicolas Petton <nicolas@petton.fr> | 2015-06-30 18:29:32 +0200 |
---|---|---|
committer | Nicolas Petton <nicolas@petton.fr> | 2015-06-30 18:40:19 +0200 |
commit | b1047c3b422f5280a9de6c56b1ba77e5dbc185ee (patch) | |
tree | 50386cf0758e757f6488a83e94af4f5fb0f84ad5 /lisp/emacs-lisp | |
parent | 3bea77f65504ee7c4364c300fd1f7d699e2866ac (diff) | |
download | emacs-b1047c3b422f5280a9de6c56b1ba77e5dbc185ee.tar.gz |
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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/seq.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 2d20de61711..68d40b99f70 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -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'." |