diff options
| author | Nicolas Petton | 2015-11-11 18:18:32 +0100 |
|---|---|---|
| committer | Nicolas Petton | 2015-11-11 18:20:03 +0100 |
| commit | 51d840a8a13105172211bb25d36f594aff377d8e (patch) | |
| tree | 6097c4aef0d11639fb4124e4ec0a17960ca18b6d | |
| parent | 23036bac7d470397f364d02eb992d701f1ebab4b (diff) | |
| download | emacs-51d840a8a13105172211bb25d36f594aff377d8e.tar.gz emacs-51d840a8a13105172211bb25d36f594aff377d8e.zip | |
Rename seq-p and map-p to seqp and mapp
* lisp/emacs-lisp/seq.el (seqp): New name.
* lisp/emacs-lisp/map.el (mapp): New name.
* doc/lispref/sequences.texi: Update the documentation for seqp.
* test/automated/map-tests.el: Update the tests for mapp.
| -rw-r--r-- | doc/lispref/sequences.texi | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/map.el | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/seq.el | 10 | ||||
| -rw-r--r-- | test/automated/map-tests.el | 20 |
4 files changed, 21 insertions, 21 deletions
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 84a7c325424..66d88e49411 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi | |||
| @@ -467,18 +467,18 @@ built-in sequence types, @code{seq-length} behaves like @code{length}. | |||
| 467 | @xref{Definition of length}. | 467 | @xref{Definition of length}. |
| 468 | @end defun | 468 | @end defun |
| 469 | 469 | ||
| 470 | @defun seq-p sequence | 470 | @defun seqp sequence |
| 471 | This function returns non-@code{nil} if @var{sequence} is a sequence | 471 | This function returns non-@code{nil} if @var{sequence} is a sequence |
| 472 | (a list or array), or any additional type of sequence defined via | 472 | (a list or array), or any additional type of sequence defined via |
| 473 | @file{seq.el} generic functions. | 473 | @file{seq.el} generic functions. |
| 474 | 474 | ||
| 475 | @example | 475 | @example |
| 476 | @group | 476 | @group |
| 477 | (seq-p [1 2]) | 477 | (seqp [1 2]) |
| 478 | @result{} t | 478 | @result{} t |
| 479 | @end group | 479 | @end group |
| 480 | @group | 480 | @group |
| 481 | (seq-p 2) | 481 | (seqp 2) |
| 482 | @result{} nil | 482 | @result{} nil |
| 483 | @end group | 483 | @end group |
| 484 | @end example | 484 | @end example |
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index 7ff9031b08d..98a3565f2c7 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el | |||
| @@ -58,7 +58,7 @@ unquoted form. | |||
| 58 | 58 | ||
| 59 | ARGS can also be a list of symbols, which stands for ('SYMBOL | 59 | ARGS can also be a list of symbols, which stands for ('SYMBOL |
| 60 | SYMBOL)." | 60 | SYMBOL)." |
| 61 | `(and (pred map-p) | 61 | `(and (pred mapp) |
| 62 | ,@(map--make-pcase-bindings args))) | 62 | ,@(map--make-pcase-bindings args))) |
| 63 | 63 | ||
| 64 | (defmacro map-let (keys map &rest body) | 64 | (defmacro map-let (keys map &rest body) |
| @@ -155,7 +155,7 @@ MAP can be a list, hash-table or array." | |||
| 155 | 155 | ||
| 156 | Map can be a nested map composed of alists, hash-tables and arrays." | 156 | Map can be a nested map composed of alists, hash-tables and arrays." |
| 157 | (or (seq-reduce (lambda (acc key) | 157 | (or (seq-reduce (lambda (acc key) |
| 158 | (when (map-p acc) | 158 | (when (mapp acc) |
| 159 | (map-elt acc key))) | 159 | (map-elt acc key))) |
| 160 | keys | 160 | keys |
| 161 | map) | 161 | map) |
| @@ -239,7 +239,7 @@ MAP can be a list, hash-table or array." | |||
| 239 | (map-filter (lambda (key val) (not (funcall pred key val))) | 239 | (map-filter (lambda (key val) (not (funcall pred key val))) |
| 240 | map)) | 240 | map)) |
| 241 | 241 | ||
| 242 | (defun map-p (map) | 242 | (defun mapp (map) |
| 243 | "Return non-nil if MAP is a map (list, hash-table or array)." | 243 | "Return non-nil if MAP is a map (list, hash-table or array)." |
| 244 | (or (listp map) | 244 | (or (listp map) |
| 245 | (hash-table-p map) | 245 | (hash-table-p map) |
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 68265094c17..456efd077db 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Nicolas Petton <nicolas@petton.fr> | 5 | ;; Author: Nicolas Petton <nicolas@petton.fr> |
| 6 | ;; Keywords: sequences | 6 | ;; Keywords: sequences |
| 7 | ;; Version: 2.2 | 7 | ;; Version: 2.3 |
| 8 | ;; Package: seq | 8 | ;; Package: seq |
| 9 | 9 | ||
| 10 | ;; Maintainer: emacs-devel@gnu.org | 10 | ;; Maintainer: emacs-devel@gnu.org |
| @@ -46,7 +46,7 @@ | |||
| 46 | ;; - `seq-elt' | 46 | ;; - `seq-elt' |
| 47 | ;; - `seq-length' | 47 | ;; - `seq-length' |
| 48 | ;; - `seq-do' | 48 | ;; - `seq-do' |
| 49 | ;; - `seq-p' | 49 | ;; - `seqp' |
| 50 | ;; - `seq-subseq' | 50 | ;; - `seq-subseq' |
| 51 | ;; - `seq-into-sequence' | 51 | ;; - `seq-into-sequence' |
| 52 | ;; - `seq-copy' | 52 | ;; - `seq-copy' |
| @@ -79,7 +79,7 @@ corresponding element of SEQUENCE. | |||
| 79 | 79 | ||
| 80 | Extra elements of the sequence are ignored if fewer PATTERNS are | 80 | Extra elements of the sequence are ignored if fewer PATTERNS are |
| 81 | given, and the match does not fail." | 81 | given, and the match does not fail." |
| 82 | `(and (pred seq-p) | 82 | `(and (pred seqp) |
| 83 | ,@(seq--make-pcase-bindings patterns))) | 83 | ,@(seq--make-pcase-bindings patterns))) |
| 84 | 84 | ||
| 85 | (defmacro seq-let (args sequence &rest body) | 85 | (defmacro seq-let (args sequence &rest body) |
| @@ -117,7 +117,7 @@ Return SEQUENCE." | |||
| 117 | 117 | ||
| 118 | (defalias 'seq-each #'seq-do) | 118 | (defalias 'seq-each #'seq-do) |
| 119 | 119 | ||
| 120 | (cl-defgeneric seq-p (sequence) | 120 | (cl-defgeneric seqp (sequence) |
| 121 | "Return non-nil if SEQUENCE is a sequence, nil otherwise." | 121 | "Return non-nil if SEQUENCE is a sequence, nil otherwise." |
| 122 | (sequencep sequence)) | 122 | (sequencep sequence)) |
| 123 | 123 | ||
| @@ -433,7 +433,7 @@ SEQUENCE must be a sequence of numbers or markers." | |||
| 433 | "Return a list of `(seq ...)' pcase patterns from the argument list ARGS." | 433 | "Return a list of `(seq ...)' pcase patterns from the argument list ARGS." |
| 434 | (cons 'seq | 434 | (cons 'seq |
| 435 | (seq-map (lambda (elt) | 435 | (seq-map (lambda (elt) |
| 436 | (if (seq-p elt) | 436 | (if (seqp elt) |
| 437 | (seq--make-pcase-patterns elt) | 437 | (seq--make-pcase-patterns elt) |
| 438 | elt)) | 438 | elt)) |
| 439 | args))) | 439 | args))) |
diff --git a/test/automated/map-tests.el b/test/automated/map-tests.el index 1a759b523a5..2a7fcc39d41 100644 --- a/test/automated/map-tests.el +++ b/test/automated/map-tests.el | |||
| @@ -126,16 +126,16 @@ Evaluate BODY for each created map. | |||
| 126 | (should (null (map-nested-elt vec '(2 1 1)))) | 126 | (should (null (map-nested-elt vec '(2 1 1)))) |
| 127 | (should (= 4 (map-nested-elt vec '(2 1 1) 4))))) | 127 | (should (= 4 (map-nested-elt vec '(2 1 1) 4))))) |
| 128 | 128 | ||
| 129 | (ert-deftest test-map-p () | 129 | (ert-deftest test-mapp () |
| 130 | (should (map-p nil)) | 130 | (should (mapp nil)) |
| 131 | (should (map-p '((a . b) (c . d)))) | 131 | (should (mapp '((a . b) (c . d)))) |
| 132 | (should (map-p '(a b c d))) | 132 | (should (mapp '(a b c d))) |
| 133 | (should (map-p [])) | 133 | (should (mapp [])) |
| 134 | (should (map-p [1 2 3])) | 134 | (should (mapp [1 2 3])) |
| 135 | (should (map-p (make-hash-table))) | 135 | (should (mapp (make-hash-table))) |
| 136 | (should (map-p "hello")) | 136 | (should (mapp "hello")) |
| 137 | (should (not (map-p 1))) | 137 | (should (not (mapp 1))) |
| 138 | (should (not (map-p 'hello)))) | 138 | (should (not (mapp 'hello)))) |
| 139 | 139 | ||
| 140 | (ert-deftest test-map-keys () | 140 | (ert-deftest test-map-keys () |
| 141 | (with-maps-do map | 141 | (with-maps-do map |