Faster implementation of map-empty-p
* lisp/emacs-lisp/map.el (map-empty-p): Faster implementation using specific tests depending on the type of the map.
This commit is contained in:
parent
12a3ea52c4
commit
a5237a0499
1 changed files with 5 additions and 1 deletions
|
@ -150,7 +150,11 @@ FUNCTION is called with two arguments, the key and the value."
|
|||
(arrayp map)))
|
||||
|
||||
(defun map-empty-p (map)
|
||||
(null (map-keys map)))
|
||||
"Return non-nil is MAP is empty."
|
||||
(map--dispatch map
|
||||
:list (null map)
|
||||
:array (seq-empty-p map)
|
||||
:hash-table (zerop (hash-table-count map))))
|
||||
|
||||
(defun map-contains-key-p (map key &optional testfn)
|
||||
"Return non-nil if MAP contain the key KEY, nil otherwise.
|
||||
|
|
Loading…
Add table
Reference in a new issue