Oddbean new post about | logout
 @6adcf666 You probably have to get all the keys first:

(defun hash-table-keys (hash-table)
  (let ((keys ()))
    (maphash (lambda (k v) (push k keys)) hash-table)
    keys))


and then run your own iteration. You are right, hash tables are not a first class citizen in Elisp, unfortunately. 
 @488cf7e2 This is for my #emacslisp port of Transducers though. CL has with-hash-table-iterator which makes this easy, since I can drive the iteration myself and stop when I want, but I don't see an analog in Elisp. 
 @6adcf666 If it's just about exiting early, this is how you can do it in Elisp:

(catch 'stop
  (maphash
   ;; do you stuff here
   ;; exit when you want    
    (throw 'stop retval)
   ht))
 
 @488cf7e2 @6adcf666 I usually use cl-loop. It uses maphash inside, but it also allows early return with cl-block ... cl-return-from, and a few other nice things.

And cl-block ... cl-return-from is essentially catch ... throw with an autogenerated exception name and lexical scoping. 
 @488cf7e2 Evil, but plausible.