]> code.delx.au - gnu-emacs/commitdiff
Rename map-contains-key-p and map-some-p
authorNicolas Petton <nicolas@petton.fr>
Sat, 5 Sep 2015 22:45:48 +0000 (00:45 +0200)
committerNicolas Petton <nicolas@petton.fr>
Sat, 5 Sep 2015 22:48:06 +0000 (00:48 +0200)
Remove the "-p" suffix from both function names.

* lisp/emacs-lisp/map.el (map-contains-key, map-some): Rename the functions.
* test/automated/map-tests.el (test-map-contains-key, test-map-some):
  Update both test functions.

lisp/emacs-lisp/map.el
test/automated/map-tests.el

index 5014571a37b6f548ff3d971ffbd20789aff31bd6..4e7d3b91b16019fa41e090ae440af73d247895f4 100644 (file)
@@ -249,15 +249,15 @@ MAP can be a list, hash-table or array."
     :array (seq-empty-p map)
     :hash-table (zerop (hash-table-count map))))
 
-(defun map-contains-key-p (map key &optional testfn)
+(defun map-contains-key (map key &optional testfn)
   "Return non-nil if MAP contain the key KEY, nil otherwise.
 Equality is defined by TESTFN if non-nil or by `equal' if nil.
 
 MAP can be a list, hash-table or array."
-  (seq-contains-p (map-keys map) key testfn))
+  (seq-contains (map-keys map) key testfn))
 
-(defun map-some-p (pred map)
-  "Return a key/value pair for which (PRED key val) is non-nil in MAP.
+(defun map-some (pred map)
+  "Return a non-nil if (PRED key val) is non-nil for any key/value pair in MAP.
 
 MAP can be a list, hash-table or array."
   (catch 'map--break
index 1f3a07e3f3bba8a601276b87960b12176156ac5a..ca680041944e8fa440f6eefbf8e4decd69d79002 100644 (file)
@@ -252,29 +252,29 @@ Evaluate BODY for each created map.
   (should (not (map-empty-p "hello")))
   (should (map-empty-p "")))
 
-(ert-deftest test-map-contains-key-p ()
-  (should (map-contains-key-p '((a . 1) (b . 2)) 'a))
-  (should (not (map-contains-key-p '((a . 1) (b . 2)) 'c)))
-  (should (map-contains-key-p '(("a" . 1)) "a"))
-  (should (not (map-contains-key-p '(("a" . 1)) "a" #'eq)))
-  (should (map-contains-key-p [a b c] 2))
-  (should (not (map-contains-key-p [a b c] 3))))
-
-(ert-deftest test-map-some-p ()
+(ert-deftest test-map-contains-key ()
+  (should (map-contains-key '((a . 1) (b . 2)) 'a))
+  (should (not (map-contains-key '((a . 1) (b . 2)) 'c)))
+  (should (map-contains-key '(("a" . 1)) "a"))
+  (should (not (map-contains-key '(("a" . 1)) "a" #'eq)))
+  (should (map-contains-key [a b c] 2))
+  (should (not (map-contains-key [a b c] 3))))
+
+(ert-deftest test-map-some ()
   (with-maps-do map
-    (should (equal (map-some-p (lambda (k _v)
+    (should (equal (map-some (lambda (k _v)
                                  (eq 1 k))
                                map)
                    (cons 1 4)))
-    (should (not (map-some-p (lambda (k _v)
+    (should (not (map-some (lambda (k _v)
                                (eq 'd k))
                              map))))
   (let ((vec [a b c]))
-    (should (equal (map-some-p (lambda (k _v)
+    (should (equal (map-some (lambda (k _v)
                                  (> k 1))
                                vec)
                    (cons 2 'c)))
-    (should (not (map-some-p (lambda (k _v)
+    (should (not (map-some (lambda (k _v)
                                (> k 3))
                              vec)))))