diff options
| author | K. Handa <handa@gnu.org> | 2015-09-08 20:43:11 +0900 |
|---|---|---|
| committer | K. Handa <handa@gnu.org> | 2015-09-08 20:43:11 +0900 |
| commit | 94ed5167557112fb00eeca05e62589db744206de (patch) | |
| tree | 80a544f8534802dd61fbd218b97441d3419dbf6b /lisp/emacs-lisp/map.el | |
| parent | 33f2e0023a5ef03db3e99ade0b93a7a1a913dbe1 (diff) | |
| parent | 10e7f7de910ca816799062f33b830f7598801f0e (diff) | |
| download | emacs-94ed5167557112fb00eeca05e62589db744206de.tar.gz | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'lisp/emacs-lisp/map.el')
| -rw-r--r-- | lisp/emacs-lisp/map.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index 5014571a37b..ea56efefe97 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -249,21 +249,22 @@ 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 (map-apply (lambda (key value) - (when (funcall pred key value) - (throw 'map--break (cons key value)))) + (let ((result (funcall pred key value))) + (when result + (throw 'map--break result)))) map) nil)) |
