emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 7ca776e: Update seq.el to version 1.8


From: Nicolas Petton
Subject: [elpa] master 7ca776e: Update seq.el to version 1.8
Date: Thu, 09 Jul 2015 17:39:34 +0000

branch: master
commit 7ca776ebbf0ecb38b4276aace22de2646ab5e569
Author: Nicolas Petton <address@hidden>
Commit: Nicolas Petton <address@hidden>

    Update seq.el to version 1.8
    
    * packages/seq/seq.el: Update to version 1.8.
    * packages/seq/tests/seq-tests.el: Update to version 1.8.
---
 packages/seq/seq.el             |   16 +++++++++++++---
 packages/seq/tests/seq-tests.el |    5 +++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/packages/seq/seq.el b/packages/seq/seq.el
index 5553de6..93fefd0 100644
--- a/packages/seq/seq.el
+++ b/packages/seq/seq.el
@@ -4,7 +4,7 @@
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; Keywords: sequences
-;; Version: 1.7
+;; Version: 1.8
 ;; Package: seq
 
 ;; Maintainer: address@hidden
@@ -279,7 +279,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if 
nil."
               '()))
 
 (defun seq-difference (seq1 seq2 &optional testfn)
-  "Return a list of th elements that appear in SEQ1 but not in SEQ2.
+  "Return a list of the elements that appear in SEQ1 but not in SEQ2.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
   (seq-reduce (lambda (acc elt)
                 (if (not (seq-contains-p seq2 elt testfn))
@@ -325,6 +325,16 @@ TYPE can be one of the following symbols: vector, string 
or list."
     (`list (append seq nil))
     (t (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'."
@@ -442,7 +452,7 @@ If no element is found, return nil."
 (unless (fboundp 'elisp--font-lock-flush-elisp-buffers)
   ;; In Emacsā‰„25, (via elisp--font-lock-flush-elisp-buffers and a few others)
   ;; we automatically highlight macros.
-  (add-to-list 'emacs-lisp-mode-hook #'seq--activate-font-lock-keywords))
+  (add-hook 'emacs-lisp-mode-hook #'seq--activate-font-lock-keywords))
 
 (provide 'seq)
 ;;; seq.el ends here
diff --git a/packages/seq/tests/seq-tests.el b/packages/seq/tests/seq-tests.el
index ab46eb8..3643ce5 100644
--- a/packages/seq/tests/seq-tests.el
+++ b/packages/seq/tests/seq-tests.el
@@ -297,5 +297,10 @@ Evaluate BODY for each created sequence.
       (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]