2.11 Backward compatibility
hash-element hash-elementsThe loop methods
hash-element
andhash-elements
access the elements of a hash table; the iteration can optionally access the key for each element. Since hash table entries are specified by keys, the order in which the values are accessed is undefined. Empty entries in the hash table are ignored.;; Create a hash table, put some values in it, and then collect ;; both the values and their keys. > (let ((hashtable (make-hash-table :size 10))) (loop for i from 1 to 10 do (setf (gethash i hashtable) (format nil "~S" i))) (loop for h being the hash-elements of hashtable with-key k collect (list h k)) ) (("10" 10) ("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) ("6" 6) ("7" 7) ("8" 8) ("9" 9))For information about loop methods that access hash table values and hash table keys, see Section 2.9 on page 43.
Generated with Harlequin WebMaker