Commit f29cb4a8 authored by Peter Hildebrandt's avatar Peter Hildebrandt
Browse files

added store-items to get an (a)list of all items

parent be395425
......@@ -18,7 +18,7 @@ See the Lisp Lesser GNU Public License for more details.
(in-package :cells)
(export! cells-store bwhen-c-stored c?-with-stored with-store-item store-add store-lookup store-remove)
(export! cells-store bwhen-c-stored c?-with-stored with-store-item store-add store-lookup store-remove store-items)
(defmacro c?-with-stored ((var key store &optional default) &body body)
`(c? (bwhen-c-stored (,var ,key ,store ,default)
......@@ -118,6 +118,11 @@ See the Lisp Lesser GNU Public License for more details.
(with-store-entry (key store :quiet quiet)
(setf (item key store) nil)))
(defmethod store-items ((store cells-store) &key (include-keys nil))
(loop for key being the hash-keys in (data store)
for val being the hash-values in (data store)
if (and (cdr val) include-keys) collect (cons key (cdr val))
else if (cdr val) collect it))
;;; unit test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment