Skip to content
Snippets Groups Projects
Commit e44c2574 authored by Kevin M. Rosenberg's avatar Kevin M. Rosenberg
Browse files

Add formatting options to print-hash-table

parent 469b6701
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,23 @@ ...@@ -19,6 +19,23 @@
;;; hashs ;;; hashs
(defun print-hash (h &key (stream *standard-output*)
key-transform-fn value-transform-fn
(prefix "") (divider " -> ") (terminator "~%"))
(maphash #'(lambda (k v)
(format stream "~A~S~A~S~%"
prefix
(if key-transform-fn
(funcall key-transform-fn k)
k)
divider
(if value-transform-fn
(funcall value-transform-fn v)
v)
(when terminator (format stream terminator)))
h)
h)
(defun print-hash (h &optional (stream *standard-output*)) (defun print-hash (h &optional (stream *standard-output*))
(maphash #'(lambda (k v) (format stream "~S -> ~S~%" k v)) h) (maphash #'(lambda (k v) (format stream "~S -> ~S~%" k v)) h)
h) h)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment