Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hash-table, *print-readably* and *print-circle*

74 views
Skip to first unread message

budden

unread,
Oct 14, 2012, 4:34:14 AM10/14/12
to
Hi list!
Is there some library which contains portable code to print hashtables with *print-readably*=t and *print-circle*=t?
I want to see something like (#1=#:g902113 #.(make-filled-hash-table (:test 'eq) #1# 4)) at my *standard-output*

budden

unread,
Oct 14, 2012, 7:03:32 AM10/14/12
to
> Is there some library which contains portable code to print hashtables with *print-readably*=t and *print-circle*=t?
This solves problem for my, but I guess someone have done this before?
http://paste.lisp.org/+2UAB

Pascal J. Bourguignon

unread,
Oct 19, 2012, 8:24:45 AM10/19/12
to
Notice that defining a print-object methond on hash-table (or any other
standard class) is not conforming.

However if you want a general solution, you would have to reimplement about
the whole lisp printer system, so if it works for you, good. Just beware
that it may break on some other implementation.
--
__Pascal J. Bourguignon__

Norbert_Paul

unread,
Oct 19, 2012, 10:02:21 AM10/19/12
to
Wouldn't is be enough to shadow the hash-table - related symbols of which there are
not so many and redefine them in your own package and then do something like
(defstruct hash-table (table (error) :type cl:hash-table :read-only t))
(defun make-hash-table (...)...) ; delegate to cl:make-hash-table
...
?
This is smaller than the whole Lisp printer system, I guess.

Barry Margolin

unread,
Oct 19, 2012, 10:09:36 AM10/19/12
to
In article <k5rmhe$1ad$1...@dont-email.me>,
That will work for hash tables you create directly, but not hash tables
created by code you call.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

budden

unread,
Oct 23, 2012, 11:57:10 AM10/23/12
to
Hi Pascal!
> Notice that defining a print-object methond on hash-table (or any other
> standard class) is not conforming.
Thank you for the notice. Is there a portable way to change printing behaviour of hash tables? Maybe set-pprint-dispatch?

Pascal J. Bourguignon

unread,
Oct 25, 2012, 9:29:22 AM10/25/12
to
I don't know the pretty printer of CL (*^.^*).

--
__Pascal J. Bourguignon__
0 new messages