diff options
| -rw-r--r-- | lisp/emacs-lisp/map.el | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index f5a9fd9ee12..1d8a3126bba 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el | |||
| @@ -106,11 +106,11 @@ form. | |||
| 106 | "Perform a lookup in MAP of KEY and return its associated value. | 106 | "Perform a lookup in MAP of KEY and return its associated value. |
| 107 | If KEY is not found, return DEFAULT which defaults to nil. | 107 | If KEY is not found, return DEFAULT which defaults to nil. |
| 108 | 108 | ||
| 109 | If MAP is a list, `equal' is used to lookup KEY. | 109 | If MAP is a list, `eql' is used to lookup KEY. |
| 110 | 110 | ||
| 111 | MAP can be a list, hash-table or array." | 111 | MAP can be a list, hash-table or array." |
| 112 | (map--dispatch map | 112 | (map--dispatch map |
| 113 | :list (map--elt-list map key default) | 113 | :list (alist-get key map default) |
| 114 | :hash-table (gethash key map default) | 114 | :hash-table (gethash key map default) |
| 115 | :array (map--elt-array map key default))) | 115 | :array (map--elt-array map key default))) |
| 116 | 116 | ||
| @@ -324,14 +324,6 @@ MAP can be a list, hash-table or array." | |||
| 324 | (setq index (1+ index)))) | 324 | (setq index (1+ index)))) |
| 325 | map))) | 325 | map))) |
| 326 | 326 | ||
| 327 | (defun map--elt-list (map key &optional default) | ||
| 328 | "Lookup, in the list MAP, the value associated with KEY and return it. | ||
| 329 | If KEY is not found, return DEFAULT which defaults to nil." | ||
| 330 | (let ((pair (assoc key map))) | ||
| 331 | (if pair | ||
| 332 | (cdr pair) | ||
| 333 | default))) | ||
| 334 | |||
| 335 | (defun map--elt-array (map key &optional default) | 327 | (defun map--elt-array (map key &optional default) |
| 336 | "Return the element of the array MAP at the index KEY. | 328 | "Return the element of the array MAP at the index KEY. |
| 337 | If KEY is not found, return DEFAULT which defaults to nil." | 329 | If KEY is not found, return DEFAULT which defaults to nil." |