Function: map-length
map-length is a byte-compiled function defined in map.el.gz.
Signature
(map-length MAP)
Documentation
Return the number of key/value pairs in MAP.
Note that this does not always reflect the number of unique keys.
The default implementation delegates to map-do.
Other relevant functions are documented in the map group.
Shortdoc
;; map
(map-length (list 'bar 1 'foo 2 'baz 3))
=> 3
(map-length (list '(bar . 1) '(foo . 2) '(baz . 3)))
=> 3
(map-length [bar foo baz])
=> 3
(map-length #s(hash-table data (bar 1 foo 2 baz 3)))
=> 3
Implementations
(map-length (MAP array)) in `map.el'.
Undocumented
(map-length (MAP list)) in `map.el'.
Undocumented
(map-length (MAP hash-table)) in `map.el'.
Undocumented
(map-length MAP) in `map.el'.
Undocumented
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/map.el.gz
(cl-defgeneric map-length (map)
;; FIXME: Should we rename this to `map-size'?
"Return the number of key/value pairs in MAP.
Note that this does not always reflect the number of unique keys.
The default implementation delegates to `map-do'."
(let ((size 0))
(map-do (lambda (_k _v) (setq size (1+ size))) map)
size))