# HG changeset patch # User Steve Losh # Date 1487762369 0 # Node ID 85823854b8cbdb3ec8eaf248aeb7b1bd2acafe01 # Parent 12fd42abb3ba3a0365b44b6cb02d0ab95bdcca22 Add `in-hashset` iterate driver diff -r 12fd42abb3ba -r 85823854b8cb losh.lisp --- a/losh.lisp Tue Feb 21 20:50:17 2017 +0000 +++ b/losh.lisp Wed Feb 22 11:19:29 2017 +0000 @@ -1534,6 +1534,10 @@ (keywordize-clause clause)))))) +(defmacro-driver (FOR var IN-HASHSET hset) + (let ((kwd (if generate 'generate 'for))) + `(,kwd (,var) :in-hashtable (hash-set-storage ,hset)))) + ;;;; Hash Tables -------------------------------------------------------------- (defun mutate-hash-values (function hash-table) @@ -1970,6 +1974,7 @@ #+sbcl (defmacro profile (&body body) + "Profile `body` and dump the report to `lisp.prof`." `(progn (start-profiling) (unwind-protect @@ -2250,6 +2255,7 @@ (hash-table-keys storage)) + ;;;; Bit Sets ----------------------------------------------------------------- ;;; Implementation of the sets-as-integers idea in the Common Lisp Recipes book. (deftype bset () '(integer 0)) diff -r 12fd42abb3ba -r 85823854b8cb package.lisp --- a/package.lisp Tue Feb 21 20:50:17 2017 +0000 +++ b/package.lisp Wed Feb 22 11:19:29 2017 +0000 @@ -134,7 +134,8 @@ :hset-filter :hset-filter! :hset-map - :hset-map!)) + :hset-map! + )) (defpackage :losh.hash-tables (:documentation "Utilities for operating on hash tables.") @@ -160,6 +161,7 @@ :every-nth :for-nested :in-array + :in-hashset :in-lists :in-sequences :in-whatever