85823854b8cb

Add `in-hashset` iterate driver
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 22 Feb 2017 11:19:29 +0000
parents 12fd42abb3ba
children 2746fc7667d9
branches/tags (none)
files losh.lisp package.lisp

Changes

--- 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))
--- 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