Subject: Re: Atom (was: String) Representation

From: Jan Wielemaker <[email-masked]>
Date: Fri, 12 May 2000 10:22:19 +0200

> Jan Wielemaker wrote:
> 
> > ...  SWI-Prolog
> > has no limitations on length nor content for atoms and they are subject
> > to garbage collection.
> 
> ...which makes them irresistible (to a heretic like me) for holding e.g.
> LONGVARCHAR values retrieved from an RDBMS.  Hence my request: in the
> debugger's "print" mode, when terms are displayed only to max_depth(10)
> or whatever, could very long atoms also be truncated?  OLE Objects can
> be a bit tedious as they scroll past :-)

Might be worthwhile.  For now, you can simply do:

user:portray(LongAtom) :-
	atom(LongAtom),
	atom_length(LongAtom, Len),
	Len > 1000,
	sub_atom(LongAtom, 0, 30, _, Start),
	sub_atom(LongAtom, _, 20, 0, End),
	format('\'~w ... ~w\'', [Start, End]).

(not tested).

	Regards --- Jan