Xah Talk Show 2025-07-16 Ep682 Ask Grok AI to Generate Hashtable in Emacs Lisp

timestamp
- timestamp
- 03:35 Asking grok AI to generate hashtable in emacs lisp
- 05:47 checking grok's code
- 16:42 download Wolfram language
- 19:58 emacs lisp keyword symbol
- 20:48 emacs lisp symbol
- 30:21 Xah Fly Keys, config hl line mode
- Asking grok AI to generate hashtable in emacs lisp
- https://youtu.be/xNsmzsYBYrU?t=215
- Checking grok's code
- https://youtu.be/xNsmzsYBYrU?t=347
- emacs lisp keyword symbol
- https://youtu.be/xNsmzsYBYrU?t=1198
- Xah Fly Keys, config hl line mode
- https://youtu.be/xNsmzsYBYrU?t=1821
Ask Grok AI Generate Code of Hashtable in Emacs Lisp
https://x.com/i/grok/share/UXOzKGzitW6KeP16oMxVYlGdI
my evaluation: perfect.

;; Create a hash table (defun create-hash-table (&optional size) "Create a new hash table with optional SIZE." (make-hash-table :test 'equal :size (or size 100))) ;; Put key-value pair into hash table (defun hash-put (table key value) "Store KEY with VALUE in TABLE." (puthash key value table)) ;; Get value from hash table (defun hash-get (table key &optional default) "Retrieve value for KEY from TABLE, return DEFAULT if not found." (gethash key table default)) ;; Remove key-value pair from hash table (defun hash-remove (table key) "Remove KEY and its value from TABLE." (remhash key table)) ;; Check if key exists in hash table (defun hash-contains (table key) "Return t if KEY exists in TABLE, nil otherwise." (not (eq (gethash key table 'not-found) 'not-found))) ;; Get all keys in hash table (defun hash-keys (table) "Return a list of all keys in TABLE." (let (keys) (maphash (lambda (key _) (push key keys)) table) keys)) ;; Get all values in hash table (defun hash-values (table) "Return a list of all values in TABLE." (let (values) (maphash (lambda (_ value) (push value values)) table) values)) ;; Get hash table size (defun hash-size (table) "Return the number of entries in TABLE." (hash-table-count table)) ;; Clear hash table (defun hash-clear (table) "Remove all entries from TABLE." (clrhash table)) ;; Example usage: (defun hash-table-example () "Demonstrate hash table usage." (let ((my-table (create-hash-table))) ;; Add some key-value pairs (hash-put my-table "name" "John") (hash-put my-table "age" 30) (hash-put my-table "city" "New York") ;; Print some values (message "Name: %s" (hash-get my-table "name")) (message "Age: %s" (hash-get my-table "age")) (message "Has city? %s" (hash-contains my-table "city")) (message "Keys: %s" (hash-keys my-table)) (message "Values: %s" (hash-values my-table)) (message "Size: %d" (hash-size my-table)) ;; Remove an entry (hash-remove my-table "age") (message "After removing age, size: %d" (hash-size my-table)) ;; Clear the table (hash-clear my-table) (message "After clearing, size: %d" (hash-size my-table)))) (hash-table-example)
Meaning of Symbols in Emacs Lisp
xx = 3 print(xx) # 3
(setq xx 3) ;; 3 (quote xx) ;; xx
Download Wolfram Language

Emacs: Xah Fly Keys. Mode Status Indicator
- change my hi-line-mode config
- Emacs: Xah Fly Keys. Mode Status Indicator
- so when in terminal, highlight just 1 char.
- in graphical user interface, highlight first 10 char, if empty line, none