A Very Brief Intro to CCL (LISP) HashTables

This is mostly just useful to myself, but I don't see why search engines can't help others find it if it's useful to them. A nice hashtable reference is the CL-cookbook.

(defvar *table* nil)

(setf *table* (make-hash-table :test 'eql :size (expt 2 20))) ; symbol keys can use :eq

(setf (gethash :myueberkey *table*) "2008-and-late")

(gethash :myueberkey *table*) ; returns (mv stored-value t-if-it-was-found)

(maphash (lambda (key value) (setf (gethash key *table2*) value)) *table*)

; count the number of entries in the hash-table
(hash-table-count *table*)

; print all keys and values
(maphash (lambda (key value) (format t "key: ~a ~%value: ~a~%~%" key value)) *hash*)

Valid XHTML 1.1