Function: hash-make
hash-make is a byte-compiled function defined in hasht.el.
Signature
(hash-make INITIALIZER &optional REVERSE)
Documentation
Create and return a hash table from INITIALIZER.
INITIALIZER may be an alist with elements of the form (<value> . <key>)
from which the hash table is built (<key> must be a string).
Alternatively, it may be a non-negative integer which is used as the
minimum size of a new, empty hash table. Optional non-nil second
argument REVERSE means INITIALIZER has elements of form
(<key> . <value>).
The resultant value associated with a <key> is the <value> from the last
entry in INITIALIZER with that <key>. See hash-make-prepend to
merge all the values for a given <key> instead.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hasht.el
(defun hash-make (initializer &optional reverse)
"Create and return a hash table from INITIALIZER.
INITIALIZER may be an alist with elements of the form (<value> . <key>)
from which the hash table is built (<key> must be a string).
Alternatively, it may be a non-negative integer which is used as the
minimum size of a new, empty hash table. Optional non-nil second
argument REVERSE means INITIALIZER has elements of form
\(<key> . <value>).
The resultant value associated with a <key> is the <value> from the last
entry in INITIALIZER with that <key>. See `hash-make-prepend' to
merge all the values for a given <key> instead."
(cond ((integerp initializer)
(if (>= initializer 0)
(make-hash-table :size initializer)
(error "(hash-make): Initializer must be >= 0, not `%s'"
initializer)))
((numberp initializer)
(error "(hash-make): Initializer must be a positive integer, not `%f'"
initializer))
(t (let* ((size (length initializer))
(hash-table (make-hash-table :size size))
key value sym)
(if reverse
(mapc (lambda (cns)
(if (consp cns)
(setq key (car cns) value (cdr cns))
(setq key nil value nil))
(if (and (stringp key) (setq sym (intern key)))
(puthash sym value hash-table)
(error "(hash-make): 'key' must be a string, not %S" key)))
initializer)
(mapc (lambda (cns)
(if (consp cns)
(setq key (cdr cns) value (car cns))
(setq key nil value nil))
(if (and (stringp key) (setq sym (intern key)))
(puthash sym value hash-table)
(error "(hash-make): 'key' must be a string, not %S" key)))
initializer))
hash-table))))