X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=blobdiff_plain;f=hash.lisp;fp=hash.lisp;h=e849783ef99ac775a7716de71386561a365082a6;hp=0000000000000000000000000000000000000000;hb=f24004941eccdabb71485163d4bdf63ceea8dbf9;hpb=12026eac09e773e83887a6073d5a034979ce7043 diff --git a/hash.lisp b/hash.lisp new file mode 100644 index 0000000..e849783 --- /dev/null +++ b/hash.lisp @@ -0,0 +1,38 @@ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: hash.lisp +;;;; Purpose: Hash functions for KMRCL package +;;;; Programmer: Kevin M. Rosenberg +;;;; Date Started: Apr 2000 +;;;; +;;;; This file, part of KMRCL, is Copyright (c) 2002-2011 by Kevin M. Rosenberg +;;;; +;;;; KMRCL users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. +;;;; ************************************************************************* + + +(in-package #:kmrcl) + +;;; 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) +