Re: REPL output.
Thanks.
With *print-string*, the following will do it in the moment (taking
care to evaluate them in order, since we are playing with a system
call):
(defparameter *abbreviate-long-strings* nil)
(defparameter *max-length-printed-for-strings* 100)
(defadvice
((method print-object (string t))
before-print-object-for-string :before)
(obj stream)
(if (> (length obj) *max-length-printed-for-strings*)
(setf *abbreviate-long-strings* *print-string*
*print-string* *max-length-printed-for-strings*)))
(defadvice
((method print-object (string t))
after-print-object-for-string :after)
(obj stream)
(if *abbreviate-long-strings*
(setf *print-string* *abbreviate-long-strings*
*abbreviate-long-strings* nil)))
Thanks again,
Regards,
Ala'a.
On Fri, Jun 3, 2011 at 3:18 PM, Martin Simmons <martin@lispworks.com> wrote:
>
>>>>>> On Fri, 3 Jun 2011 14:36:21 +0400, Ala'a Mohammad said:
>>
>> Thanks for the pointer.
>>
>> *print-length* does not limit the size of a printed string.
>> *print-array* applies to non-string array
>>
>> Currently I need something like *print-length but which applies to
>> strings (or sequences in general).
>
> There is a currently undocumented variable hcl:*print-string* that controls
> whether the printer uses an abbreviated form for strings when *print-escape*
> is true.
>
> If *print-string* is t (the default), then strings are printed in full as
> specified by ANSI Common Lisp.
>
> If *print-string* is nil, then strings are printed as an unreadable object
> with no specific information about the string.
>
> If *print-string* is an integer, then strings longer than *print-string* are
> printed as unreadable objects that include the type, length and first
> *print-string* characters.
>
> We will add this to the documentation.
>
> --
> Martin Simmons
> LispWorks Ltd
> http://www.lispworks.com/
>
>