Subject: Re: Readable hash tables
From: Erik Naggum <erik@naggum.no>
Date: 2000/06/14
Newsgroups: comp.lang.lisp
Message-ID: <3169980799367283@naggum.no>

* Ivar Rummelhoff <ivarru@math.uio.no>
| I'm so sorry.
| 
|  (let ((dispatch
|         (let ((tab (copy-pprint-dispatch nil)))
|           (set-pprint-dispatch 'hash-table #'hash-print 0 tab)
|           tab)))
|    (defun mi-write (obj &rest args)
|      (let ((*print-pprint-dispatch* dispatch))
|        (setf (getf args :pretty) t)
|        (apply #'write obj args))))
|  
| should replace the erroneous function by the same name in my previous
| posting.

  Although not strictly erroneous, you don't really know whether the
  argument list is modifiable and safe to modify.  I highly recommend

(apply #'write obj :pretty t args)

  as only the first occurrence of a keyword argument is used and any
  redundancy is just ignored.

| Alas, this the new version insists on printing pretty...

  Well, you _could_ empty the pprint-dispatch if *print-pretty* is nil
  upon entry to the function.  An empty *pprint-dispatch* is returned
  from excl::make-pprint-dispatch without arguments in Allegro CL.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.